Mysql logon ERROR message: ERROR 1045 (28000) solution, 104528000

Source: Internet
Author: User

Mysql logon ERROR message: ERROR 1045 (28000) solution, 104528000

This article analyzes the solution to the mysql logon ERROR: ERROR 1045 (28000. We will share this with you for your reference. The details are as follows:

I. Problems:

The root user of the mysql database in the linux system of the company has set a password, but often uses the command 'mysql-u root-p' to log on to an error, and sometimes can log on again. Logon error message:

[root@localhost ~]# mysql -u root -pEnter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Ii. Reasons:The database contains empty users.

Iii. solution:

1. Stop the mysql service:

# service mysql stop

2. Enter the following 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 users found above:

mysql> delete from user where user='';

7. Exit the database:

mysql> quit

8. Start the mysql service:

# service mysql start

9. Run the following command again:

mysql -u root -p

Log on, OK!

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.