- 1. 概要
- 2. インストール
- 3. 起動
1. 概要
「MySQL」は、「postgreSQL」と並んで、フリーで提供されているデータベースです。
「MySQL」の詳細については WikiPedia をご参照ください。
実は、今回、これがメインと言えなくもない。
「FreeBSD 13.2 RELEASE」で運用しているサーバがあって、それで、「MySQL 5.7」を使用しているのですが、「ports」が依存している「openssl」関連のパッケージがなくなってしまったようなのです。
現在(2023年12月15日)のところ、アップグレードできないまま、「MySQL 5.7」を使用していますが、これを「MySQL 8.x」にのせかえたいのです。
2. インストール
2023年12月15日の時点で、「ports」には、以下のパッケージが存在します。
$ ls -d /usr/ports/databases/mysql??-server
/usr/ports/databases/mysql57-server /usr/ports/databases/mysql80-server
「mysql55-server」はおろか、「mysql56-server」もない。
「mysql57-server」は、依存するパッケージがなくなって、アップグレードできない。
ウィキペディアによれば、2023年12月15日時点の最新版は、「8.1.0」で、2023年7月10日にリリースされているらしいのですが。
現時点で、「FreeBSD」での選択肢は、「MySQL 8.0」しかないわけだ。
「MySQL 8.0」は、2018年7月3日に、以前の「FreeBSD」で「ports」の「make」でエラーになっていたのですが。
もうやってみるしかない。
cd /usr/ports/databases/mysql80-server
make config
オプションはデフォルトのままにしています。
cd /usr/ports/databases/mysql80-client
make config
こちらも、オプションはデフォルトのままにしています。

cd /usr/ports/databases/mysql80-server
make
make install
今回は、「make」がエラーにならなかったので、ほっとしました。
サーバをインストールすると同時にクライアントもインストールされます。
「make」には、結構時間がかかりますので、気長に待つ必要があります。
インストール時のログを掲載しておきます。
「5.7」の頃より、あっさりしている気がします。
===> Installing for mysql80-server-8.0.35
===> Checking if mysql80-server is already installed
===> Registering installation for mysql80-server-8.0.35
Installing mysql80-server-8.0.35...
===> Creating groups.
Creating group 'mysql' with gid '88'.
===> Creating users
Creating user 'mysql' with uid '88'.
===> Creating homedir(s)
There is no initial password for first time use of MySQL.
Keep in mind to reset it to a secure password.
MySQL80 has a default /usr/local/etc/mysql/my.cnf,
remember to replace it with 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/libmysqlrouter_io_component.so.1
/usr/local/lib/mysql/mysqlrouter/http_server.so
/usr/local/lib/mysql/plugin/group_replication.so
/usr/local/libexec/mysqld
/usr/local/lib/mysql/libmysqlharness.so.1
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/
そお言えば、前回「MySQL 5.7」をインストールしたときに、こんなメッセージが出力されていたのを今、過去のメモを見て思い出しました。
This port is deprecated; you may wish to reconsider installing it:
Upstream support ended in October 2019.
It is scheduled to be removed on or after 2023-12-31.
「port」非推奨で、アップストリームは、2019年10月に終了していて、2023年12月31日以降には、削除する予定とのこと。
ぎりぎりだったな。
3. 起動
デフォルトの設定でいったん起動します。
起動設定。
sysrc mysql_enable=YES
sysrc mysql_optfile=/usr/local/etc/mysql/my.cnf
起動。
service mysql-server start
次に、「mysql_secure_installation」というスクリプトを起動して初期設定を行います。
これは、「MySQL 5.7」と同じだな。
これについては次ページで・・・。
|