MYSQL ERROR 1045 (28000): Access denied for user (using Password:yes) Problem resolution _MYSQL

Source: Internet
Author: User
Tags mysql login
First method: Recommended
Error description: After adding users in MySQL, you may be prompted to error 1045 (28000): Access denied for user errors.

Cause analysis: A record in the Mysql.user table where user is blank may appear, such as:

Mysql> select Host,user from user;
+------------------+------+
| Host | user |
+------------------+------+
| % | Test |
| localhost | |
| localhost | Root |
+------------------+------+
3 Rows in Set (0.00 sec)

Workaround: Delete these blank users or update to another user name

Delete the value in User.user or update null to test

1) Delete from user where user is NULL
2 Update user set user= ' test ' where user is NULL

Unexpected situation: If the above method is not effective, still appear empty users, you can use the graphical User client deletion.

the second way: under Linux
Prologue: Solving Linux problems is a pleasure, and of course, having problems is the chance to enjoy happiness on a godsend.
This time the use of mandriva2008spring.
Because to engage in a project, so need to install MySQL, the previous installation of MySQL is very smooth, especially the MySQL provided by the RMP package, just double-click can be done ~ but do not know when, MYSQL ERROR 1045 (28000): Access denied for User (using Password:yes), this denial of access problem becomes very extensive.
Baidu a bit, there is no ready-made solution, only to find out its problems.
The problem-solving thinking:
The first step is to use the Skip authorization table access, which commands the following: Mysqld_safe--user=mysql--skip-grant-tables--skip-networking & (Of course, before that, stop the MySQL service running).
The second step, mysql-uroot mysql login MySQL.
The third step is to access the user table under the MySQL database. ,mysql> SELECT * from user on my machine; Get, unexpectedly is
Empty Set (0.00 sec). This shows that my MySQL does not have any access to the user. Knowing the problem is easy to solve.
Step fourth,mysql> INSERT into user (host, user, password, select_priv, Insert_priv, Update_priv) VALUES (' localhost ', ' Usernam E ', PASSWORD (' YourPassword '), ' y ', ' y ', ' y ');
Query OK, 1 row affected, 3 warnings (0.00 sec)
Return to success, no problem. hehe ~ ~ ~ ~ ~ ~ So simple.
The fifth step, test, and then restart the MySQL service, normal login, successful!!!

Hint: MySQL system in the MySQL database, storage system data, such as the user table here is stored users information and access rights, as well as other, for example, you want to create a new database mydb, this database has the user me management, The DB table in the MySQL database will store the relevant information. Nonsense step more said.

The following are solutions for Windows:
But if we use the virtual host management system to open the user, and the number of users is more, it seems not a good idea.

I used to reinstall the MySQL, and then into the virtual host, delete one by one, reopen the database, the operation must be back up the original data directory, and finally cover the space database on it.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.