HOW TO MIGRATE MYSQL DATABASE




 SOURCE SERVER

innobackupex --user=YOURUSER --password=YOURPASSWORD /var/log/backup

innobackupex --apply-log /var/log/backup/2022-02-14_11-41-35/


NEW SERVER

systemctl stop mysql

xtrabackup --copy-back --datadir=/var/lib/mysql --target-dir=/data/2022-02-14_11-41-35

chown -R mysql.mysql /var/lib/mysql

systemctl start mysql

systemctl status mysql


Copy /etc/mysql/my.cnf (Validate parameters starting and stopping db)


If you need due to a new version upgrade 

root@mysqlposter:~# mysql_upgrade -u YOURUSER -p

Enter password: YOURPASSWORD

Checking if update is needed.

Checking server version.

Running queries to upgrade MySQL server.

Checking system database.

mysql.columns_priv                                 OK

mysql.db                                           OK

mysql.engine_cost                                  OK

mysql.event                                        OK

mysql.func                                         OK

mysql.general_log                                  OK

mysql.gtid_executed                                OK

mysql.help_category                                OK

mysql.help_keyword                                 OK

mysql.help_relation                                OK

mysql.help_topic                                   OK

.

.

.

.

.

Upgrade process completed successfully.

Checking if update is needed.

Comments