One of our servers is showing an intermittent lockup which could be caused by motherboard, PSU or hard drive so I’m configuring a replacement. The new server is and AMD64 unit so the debian installation is a different version to that installed on the current server so I was expecting a few glitches with configuration changes between package versions, but one error that came up was when I restored the MySQL databases. The procedure I followed was:
1) Move original files in /etc/mysql to a directory call ‘original_files’.
2) Restore the config files in /etc/mysql from our backup server.
3) Move original installation databases in /var/lib/mysql to a directory called ‘original files’.
3) Restore the databases by copying them directly from our backup server to /var/lib/mysql.
4) Start MySQL. This gave the error “error: ‘Access denied for user ‘debian-sys-maint’@'localhost’ (using password: YES)’”
The reason for this is that the new installation of Debian has assigned a new password to the debian-sys-maint user. The new password can be found in /etc/mysql/debian.cnf and to give the user access to mysql you need the following commands:
# mysql -u root -p
mysql> grant all privileges on *.* to ‘debian-sys-maint’@'localhost’ identified by ‘<password>” with grant option;
(Replacing <password> with the password from you /etc/mysql/debian.cnf file. )
mysql> quit
MySQL should now start correctly. One thing to watch out for is that some sources say the the syntax of the Grant statement should be “IDENTIFIED BY PASSWORD ‘<password>’” but this does not work. It should be “IDENTIFED BY ‘<password>’”.
0 Responses to “Debian MySQL Restore”
Leave a Reply