Move MySQL Database with /etc/mysql/debian.cnf

Posted on January 21, 2018 at 5:23 pm

When you move MySQL databases from datadir /var/lib/mysql/ to another server, remember to also copy the file /etc/mysql/debian.cnf to the new server, it contains the password used to connect to MySQL server via command-line. Very important if you use automated backups.

Just a quick tutorial to move a MySQL database:

1) Stop MySQL server: /etc/init.d/mysql stop
2) Copy datadir /var/lib/mysql/ to another server or location
3) Copy also /etc/mysql/debian.cnf to the new server
4) Start MySQL server: /etc/init.d/mysql start

Receive updates via email

Other Posts

Updated Posts