Mysql logon ERROR 1045 (28000), 104528000

Source: Internet
Author: User

Mysql logon ERROR 1045 (28000), 104528000
1. symptom:
[Root @ localhost ~] # Mysql-u root-p
Enter password:
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)


2. cause: the database contains empty users.


3. solution:
1) stop mysql service: # service mysql stop
2) enter the command: # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
3) log on to the database: # mysql-u root mysql
4) mysql> use mysql;
5) mysql> select user, host, password from user; the result is as follows:
+ ------ + ----------------------- + ---------- +
| User | host | password |
+ ------ + ----------------------- + ---------- +
| Root | % | mima |
| Root | localhost. localdomain | mima |
| Root | 127.0.0.1 | mima |
| Localhost |
| Localhost. localdomain |
+ ------ + ----------------------- + ---------- +
6) delete the empty user queried above: mysql> delete from user where user = '';
7) log out of the database: mysql> quit
8) start the mysql service: # service mysql start

9) log on again with the command 'mysql-u root-P'. OK!


Or:

1) Find the mysql configuration file, modify my. cnf, and add skip-grant-tables

2) restart the Database service mysql restart

3) use root to log on without a password, view the user table, and delete empty users.

4) release the database, modify my. cnf, and remove skip-grant-tables.

5) restart the database

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.