Friday, June 24, 2022

How to transfer users from MySQL 5.5 to MariaDB 10.x

On the old server:

$ mysqldump -u root -pPassWord mysql > mysql.sql
Copy mysql.sql to the new server

add to the beginning of the file the following:

drop database mysql;
create database mysql;
use mysql;
Now run it on the new machine with MariaDB server
$ mysql -u root -p < mysql.sql
Now you need to run a tool called mysql_upgrade to upgrade old imported mysql database (you need to use --force option).
$ mysql_upgrade --force
MariaDB upgrade detected
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.servers                                      OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Upgrading from a version before MariaDB-10.1
Phase 2/7: Installing used storage engines
Checking for tables with unknown storage engine
Phase 3/7: Fixing views from mysql
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
.... [ cut ] ...

Probably you need to run 'flush privileges' on the new server or restart it.

No comments: