mysql innobackupex restore note

852 查看

innobackupex 恢复遇到问题

error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

解决:

http://stackoverflow.com/questions/11644300/access-denied-for-user-debian-sys-maint

That’s because Debian has a MySQL account debian-sys-maint used for switching on/off and checking status. The password for that user should be the same as stored in /etc/mysql/debian.cnf. The file looks like this:

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = <password>
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = <password>
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

If the password doesn't match (for example because you changed it manually) the init script won't work anymore. You should set the password according to the file. So

mysql -u root -p
# Then type MySQL root password
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '<password>';

innobackupex: Error: Original data directory '/var/lib/mysql' is not empty!

1.5.1的一个bug

源里的xtrabackup 版本是2.2.5,而innobackupex 版本是1.5.1, 一开始的解决方法是直接删除/var/lib/mysql