## page was renamed from mysql-5.1 からmariadb-10.3 への移行 ## page was renamed from mysql-5.1 から Mariadb-10.3 への移行 ## page was renamed from mysql-5.1 to Mariadb-10.3 Migration # Please edit system and help pages ONLY in the master wiki! ## For more information, please see MoinMoin:MoinDev/Translation. ## IMPORTANT NOTE: ## When you use this page as a template for creating your project page: ## * please remove all lines starting with two hashes (##) ## * except the acl line, please keep that, but remove one hash, so it reads #acl ... ## * fix the acl line so it has the correct page instead of the sample Project/...Group ##acl Project/AdminGroup:admin,read,write,delete,revert Project/ReadWriteGroup:read,write Project/ReadGroup:read ##master-page:Unknown-Page ##master-date:Unknown-Date #format wiki #language en = MySQL-5.1 から MariaDB-10.3 への移行 = 1. CentOS 6上の mysql-5.1.73 のデータベースをCentOS 8の mariadb-10.3.11 に移行した時のメモです。  ちなみに、CentOS 6上の mysql-5.1.73 のデータベースから CentOS 7 上の mariadb-5.5.64 への移行は DBディレクトリー /var/lib/mysql の中身の単純コピー(tarで固めて、展開)で正常に移行できましたが、 mysql-5.1.73 から mariadb-10.3.11 へは、 /var/lib/mysql の中身の単純コピーでは mariadb-10.3.11 起動時にエラーとなってこの方法では移行できません。従って、データベースのダンプをとって、そのダンプファイルをリストアする方法で移行します。 2. CentOS 6上の mysql-5.1.73 のデータベース 全体のダンブファイルを取ります。(データベース全体のダンプファイルを取ることが重要で特定の移行したいデータベースだけのダンプをとると、後で正常にリストアできません) {{{ # mysqldump -u root --password=xxxxxxxx --all-databases --events > alldump-20190930.sql }}} 3. CentOS 8の mariadb-10.3.11 で、あらかじめ移行したいDB(ここでは仮に DBname とします)を作成したのち、 {{{ # mysql -u root -p Enter password: MariaDB [(none)]> create database DBname; MariaDB [(none)]> exit; }}} 上のダンプファイルから移行したいデータベースをリストアします。 {{{ # mysql -u root -p DBname < alldump-20190930.sql Enter password: }}} 正常に移行されているかどうかは、DB名を選択して Table等を表示させればわかります。 {{{ # mysql -u root -p Enter password: MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | DBname | | test | +--------------------+ MariaDB [(none)]> use DBname; MariaDB [DBname]> show tables; +-----------------------------+ | Tables_in_DBname | +-----------------------------+ | admin_user | | article | | m_category | +-----------------------------+ 3 rows in set (0.000 sec) MariaDB [DBname]> exit; Bye # }}} データベースのバージョン更新の反映設定(これを実行しないと mysqldump でエラーが出ます) {{{ # mysql_upgrade -u root -p --verbose Enter password: Looking for 'mysql' as: mysql Looking for 'mysqlcheck' as: mysqlcheck MySQL upgrade detected Phase 1/7: Checking and upgrading mysql database Processing databases : : Phase 7/7: Running 'FLUSH PRIVILEGES' OK # # systemctl restart mariadb }}}