- 1. 概要
- 2. バックアップ
- 3. config
- 4. アップグレード
- 4. サーバ起動
- 5. リストア
1. 概要
いずれ、きちんと書こうと思うが、とりあえず要点だけ。
もう、「MySQL 5.7」は、使えないので「MySQL 8.0」へ移行します。
2024年1月2日現在、「FreeBSD」では、「MySQL」は、「8.0」しかないのです。
リストアするときにつまずいたのが。
ERROR 3554 (HY000) at line 318: Access to system table 'mysql.innodb_index_stats' is rejected.
ERROR 3554 (HY000) at line 320: Access to system table 'mysql.innodb_table_stats' is rejected.
下記のサイトを参考にさせていただきました。
「MySQL 8.0 における mysqldump の変更点について」
以下の作業は、すべて、「root」ユーザ権限で。
2. バックアップ
バックアップ。
冒頭に書いた、つまづきが響かないように・・・。
mysqldump -u root -p --all-databases --ignore-table=mysql.innodb_index_stats --ignore-table=mysql.innodb_table_stats > mysqldump.sql
下記のようなメッセージが、出力されますが、とりあえず、今回は無視。
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events.
Warning: A dump from a server that has GTIDs enabled will by default include the GTIDs of all transactions, even those that were executed during its extraction and might not be represented in the dumped data. This might result in an inconsistent data dump.
In order to ensure a consistent backup of the database, pass --single-transaction or --lock-all-tables or --master-data.
これで、いったん「mysql-server」を停止。
service mysql-server stop
3. config
先に、「MySQL 8.0」のコンフィグレーションを設定しておきます。

とりあえず、デフォルトのままで。
4. アップグレード
「ports」と「pkg」のバージョンを変更します。
「MySQL」以外に、「OpenLDAP」というものへも必要でした。
しかも、「OpenLDAP」は、変更して、インストールまで。
pkg set -o net/openldap24-client:net/openldap26-client
Change origin from net/openldap24-client to net/openldap26-client for openldap24-client-2.4.59_4? [y/N]:
y Enter で答えます。
portupgrade -f net/openldap24-client -o net/openldap26-client
cd /usr/ports/net/openldap26-client
make config
デフォルトのままで。

cd /usr/ports/net/openldap26-client
make
make reinstall
ところが、これがインストール時に、こける。
===> Deinstalling for openldap26-client
===> openldap26-client not installed, skipping
===> Installing for openldap26-client-2.6.6
===> openldap26-client-2.6.6 conflicts with installed package(s):
openldap24-client-2.4.59_4
They install files into the same place.
You may want to stop build with Ctrl + C.
===> Checking if openldap26-client is already installed
===> Registering installation for openldap26-client-2.6.6
Installing openldap26-client-2.6.6...
pkg-static: openldap26-client-2.6.6 conflicts with openldap24-client-2.4.59_4 (installs files into the same place). Problematic file: /usr/local/bin/ldapadd
*** Error code 1
Stop.
make[2]: stopped in /usr/ports/net/openldap26-client
*** Error code 1
Stop.
make[1]: stopped in /usr/ports/net/openldap26-client
*** Error code 1
Stop.
make: stopped in /usr/ports/net/openldap26-client
「openldap24-client」ちゅうのが、「ports」からなくなっておるので、「pkg」で削除背にゃなりません。
pkg delete openldap24-client
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 5 packages (of 0 packages in the universe):
Installed packages to be REMOVED:
mysql57-client: 5.7.42
mysql57-server: 5.7.42
openldap24-client: 2.4.59_4
p5-DBD-mysql: 4.050_1
spamassassin: 4.0.0_4
Number of packages to be removed: 5
The operation will free 202 MiB.
Proceed with deinstalling packages? [y/N]:
y Enter で答えます。
なのでまぁ、後で、「p5-DBI」「p5-DBD-mysql」「spamassassin」をインストールしなおさなければなりません。
[1/5] Deinstalling spamassassin-4.0.0_4...
[1/5] Deleting files for spamassassin-4.0.0_4: 100%
==> You should manually remove the "spamd" user.
==> You should manually remove the "spamd" group
If you are no longer using SpamAssassin, remove /var/db/spamassassin
To delete spamd permanently, 'rmuser spamd'
Note that this will remove /var/spool/spamd
[2/5] Deinstalling mysql57-server-5.7.42...
[2/5] Deleting files for mysql57-server-5.7.42: 100%
==> You should manually remove the "mysql" user.
==> You should manually remove the "mysql" group
[3/5] Deinstalling p5-DBD-mysql-4.050_1...
[3/5] Deleting files for p5-DBD-mysql-4.050_1: 100%
[4/5] Deinstalling mysql57-client-5.7.42...
[4/5] Deleting files for mysql57-client-5.7.42: 100%
[5/5] Deinstalling openldap24-client-2.4.59_4...
[5/5] Deleting files for openldap24-client-2.4.59_4: 100%
You may need to manually remove /usr/local/etc/mail/spamassassin/local.cf if it is no longer needed.
You may need to manually remove /usr/local/etc/mysql/my.cnf if it is no longer needed.
pkg: Package database is busy while closing!
「mysql-client」「mysql-server」の「ports」と「pkg」のバージョンを変更します。
pkg set -o databases/mysql57-client:databases/mysql80-client
Change origin from databases/mysql57-client to databases/mysql80-client for mysql57-client-5.7.42? [y/N]:
y Enter で答えます。
pkg set -o databases/mysql57-server:databases/mysql80-server
Change origin from databases/mysql57-server to databases/mysql80-server for mysql57-server-5.7.42? [y/N]:
y Enter で答えます。
portupgrade -f mysql57-server -o databases/mysql80-server
では、インストール。
cd /usr/ports/databases/mysql80-server
make
make install
「mysql-client」は、依存関係で、自動でインストールされます。
4. サーバ起動
サーバを起動します。
service mysql-server start
ところが、これが、何度もこけます。
「MySQL 5.7」のコンフィグレーションのまま、起動しようとしたんですな。
いくつか書きかえる必要がありました。
下記の記述は、コメントアウトしました。
query_cache_type = 0
query_cache_size = 0
validate_password_length = 4
validate_password_policyi = LOW
validate-password = OFF
5. リストア
バックアップとっていたデータをリストアします。
mysql -u root -p < mysqldump.sql
これでうまくいくと思いきや。
ERROR 3546 (HY000) at line 4722: @GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @GLOBAL.GTID_EXECUTED
てなエラーになりまして。
これも参考サイトに書いてありました。
vi mysqldump.sql
SET @GLOBAL.GTID_PURGED='暗号っぽい';
の行をコメントアウトします。
再度、リストアにチャレンジしまして、やっとうまくいきました。
これで、無事、アップグレードできたようです。
だいぶ、はしょってしまったので、いずれ機会があれば、埋めていくつもりです・・・。
|