Mysql ERROR 1045 (28000) -- Access denied for user solution, 28000 denied
Problem description (the following scope is limited to Windows ):
D: \ develop \ ide \ mysql \ mysql5.5 \ bin> mysql-u root-p
Enter password:
ERROR 1045 (28000): Access denied for user 'odbc '@ 'localhost' (using password: NO)
Step 1: edit the configuration file in the mysql installation directoryMy. ini, In[Mysqld]Add under this entry
Skip-grant-tables
For example:
Save and exit
Step 2:Restart mysql
The restart procedure is as follows:
1. Enter the task manager to check whether mysqld.exe is running. If it is running, kill it;
The hosts file.
Step 3:Reset the password of the local mysql database
In cmd, go to the D: \ develop \ ide \ mysql \ mysql5.5 \ bin directory and enterMysql-u root-pYou can log on without a password.Password:You can directly press enter to enter without ERROR 1045 (28000), but many operations are restricted because you do not have the permission. So you need to follow the process below (The red part is the input part., Orange is the code displayed after execution ):
1. Enter the mysql database:
Mysql> use mysql;
Database changed
2. Set a new password for the root user. You must enter the new password in the bold red text box:
Mysql> update user set password = password ("New Password") Where user =" root ";
Query OK, 1 rows affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
3. Refresh the database
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
4. Exit mysql:
Mysql> quit
Bye
Step 4:Restore the my. ini file
After modification, modify it again.My. iniThis file adds"Skip-grant-tables"Delete this line,Save and exit and restart mysqlYou can.