FreeBSD 11.3 RELEASE - MySQL - 概要・インストール

 クラウディア
1. 概要
2. ports
3. 起動

1. 概要

 MySQL は postgreSQL と並んでフリーで提供されているデータベースです。  MySQL の詳細については WikiPedia をご参照ください。

2. ports

 ports に MySQL 8.0 が存在しますが、2018年7月3日に、以前の FreeBSD で ports の make でエラーになっていたので、まだ 5.7 を使おうと思います。

cd /usr/ports/databases/mysql57-server
make config
 オプションはデフォルトのままにしています。
「FreeBSD 11.3 RELEASE」-「/usr/ports/databases/mysql57-server」「make config」


cd /usr/ports/databases/mysql57-client
make config
 こちらも、オプションはデフォルトのままにしています。
「FreeBSD 11.3 RELEASE」-「/usr/ports/databases/mysql57-client」「make config」


cd /usr/ports/databases/mysql57-server
make
make install
 サーバをインストールすると同時にクライアントもインストールされます。  インストール時のログを掲載しておきます。

===>  Installing for mysql57-server-5.7.26_2
===>  Checking if mysql57-server is already installed
===>   Registering installation for mysql57-server-5.7.26_2
Installing mysql57-server-5.7.26_2...
===> Creating groups.
Creating group 'mysql' with gid '88'.
===> Creating users
Creating user 'mysql' with uid '88'.
*****************************************************************************

Remember to run mysql_upgrade the first time you start the MySQL server
after an upgrade from an earlier version.

Initial password for first time use of MySQL is saved in $HOME/.mysql_secret
ie. when you want to use "mysql -u root -p" first you should see password
in /root/.mysql_secret

MySQL57 has a default %%ETCDIR%%/my.cnf,
remember to replace it wit your own
or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf.

*****************************************************************************

===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/lib/mysql/plugin/mysqlx.so
/usr/local/lib/mysql/plugin/group_replication.so
/usr/local/libexec/mysqld

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
https://www.mysql.com/

3. 起動

 デフォルトの設定でいったん起動します。

/etc/rc.conf
 に以下の2行を加えます。

mysql_enable="YES"
mysql_optfile="/usr/local/etc/mysql/my.cnf"
 下の1行は

MySQL57 has a default %%ETCDIR%%/my.cnf,
remember to replace it wit your own
or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf.
 のログが気になったので念のため。  追加しても少なくとも悪影響はないはずです。  サーバを起動します。

service mysql-server start
 MySQL 5.7 ではこの後、mysql_secure_installation というプログラムを起動して初期設定を行います。  これについては次項で・・・。
ハイスピードプランPoint anytime