The newly installed MySQL, access MySQL database is experiencing problems: ERROR 1044 (42000): Access denied for user ' @ ' localhost ' to database ' MySQL ',
[Email protected] mysql-5.1.61]# mysql-u root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End with; or \g.
Your MySQL Connection ID is 1
Server version:5.1.61 Source Distribution
Copyright (c), +, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
mysql> use MySQL
ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '
Mysql>
The final discovery solution is:
Open My.ini, in
[Mysqld]
Skip-external-locking
Skip-name-resolve
#skip-grant-tables
Where skip-grant-tables Skip permission validation is commented out, remove the comment and restart MySQL:
[Email protected] libexec]#/usr/local/mysql/libexec/mysqld--basedir=/usr/local/mysql--datadir=/data0/mysqldata- -user=mysql--log-error=/data0/mysqldata/mysql-error.log--open-files-limit=20000--pid-file=/data0/mysqldata/ Dzwww.com-b15-5-3-36.pid--socket=/tmp/mysql.sock--port=3306
[Email protected] mysql-5.1.61]# mysql-u root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End with; or \g.
Your MySQL Connection ID is 1
Server Version:5.1.61-log Source Distribution
Copyright (c), +, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
mysql> use MySQL
Database changed
Mysql>grant all privileges on * * to [e-mail protected] identified by ' MySQL '
Then re-login OK, success!
Error 1044 (42000): Access denied for user ' @ ' localhost ' to database ' MySQL ', the solution