Problem description: My environment is apt-get installed mysql under xUbuntu12.10, and cannot be logged on. The error message is as follows: the installation is completed using the command (sudoapt-getinstallmysql-servermysql-client. the mysql service is running. in this case, you need to change the root password, but this often happens. 'accesssdeniedforuser' root' @ 'localhost' (usin
Symptom:
In my environment, I installed mysql with apt-get in xUbuntu 12.10. I cannot log on to mysql. The error message is as follows: sudo apt-get install mysql-server mysql-client) after installation. the mysql service is running. in this case, you need to change the root password, but this often happens. 'Access denied for user' root' @ 'localhost' (using password: YES) 'or other situations that cause logon Failure to mysql.
Solution:
1. Open the/etc/mysql/debian. cnf file, which stores the relevant password. My file information is as follows:
Sudovi/etc/mysql/debian. cnf # Automatically generated for Debian scripts. do not touch!
[Client]
Host = localhost
User = debian-sys-maint
Password = 6x1XG2B5p75WtFV2
Socket =/var/run/mysqld. sock
[Mysql_upgrade]
Host = localhost
User = debian-sys-maint
Password = 6x1XG2B5p75WtFV2
Socket =/var/run/mysqld. sock
Basedir =/usr
There are two lines in the [client] segment: user = and password =. This is how to install mysql through apt-get. The mysql login name and password set by the system for us
2. Enter the following command:
Mysql-udebian-sys-maint-pdebian-sys-maint is debian. content following user = in cnf. after you press enter, you will be prompted to enter the password. copy and paste the content after password = and press enter to start the mysql console.
3. After Entering the console, follow these steps:
Use mysql; update user set password = PASSWORD ('new password') where user = 'root'; flush privileges; you can enter quit; log out and log on with the root account, you can also continue other operations.
Reading:
ERROR 1044 (42000): Access denied for user ''@ 'localhost' to database' mysql http://www.linuxidc.com/Linux/2013-03/81341.htm and http://www.linuxidc.com/Linux/2012-06/63618.htm
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO) http://www.linuxidc.com/Linux/2012-11/74518.htm
MySQL reports Access denied for user when using lock tables http://www.linuxidc.com/Linux/2012-01/51802.htm without the lock tables permission
Run mysql under gentoo prompt Access denied for user 'root' @ 'localhost' resolution http://www.linuxidc.com/Linux/2007-12/9866.htm Error
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2