I have reinstalled my system to Ubuntu 12.04, after installed mysql, i found that there is an error when start mysql:
Access denied for user ‘debian-sys-maint’@'localhost’ (using password: YES)
After searching the reason via google, i at last found the reason, here is it:
That’s because debian has a mysql account for switching on/off and checking mysql status, and mysql password for that user “debian-sys-maint” should be the same stored in /etc/mysql/debian.cnf
here is the way to resolve it.
1. check the password in /etc/mysql/debian.cnf
sudo vim /etc/mysql/debian.cnf
you will see something like these:
[client]
host = localhost
user = debian-sys-maint
password = your-password-here
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = your-password-here
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
host = localhost
user = debian-sys-maint
password = your-password-here
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = your-password-here
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
2. login to mysql:
mysql -u root -p
3. grant the rights to debian-sys-maint
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘debian-sys-maint’@'localhost’ IDENTIFIED BY ‘your-password-here’ WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
Done!