Mysql Login Error Tip: Error 1045 (28000) Solution _mysql

Source: Internet
Author: User
Tags mysql login

This article analyzes the MySQL login error tip: Error 1045 (28000) solution. Share to everyone for your reference, specific as follows:

First, the question:

MySQL database of company Linux system root user set password, but often use command ' mysql-u root-p ' login error, sometimes can log in. The logon error message is:

[Root@localhost ~]# mysql-u root-p
Enter Password: 
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Second, the reason: there are empty users in the database caused by

Third, the solution:

1, stop the use of MySQL services:

# service MySQL Stop

2, enter the command:

# Mysqld_safe--user=mysql--skip-grant-tables--skip-networking & 

3, log into the database:

# mysql-u Root MySQL

4,

mysql> use MySQL;

5,

Mysql> select User,host,password from user;

The results are as follows:

+------+-----------------------+----------+
| user | Host | password |
+------+-----------------------+----------+
| Root | %                           | Mima |
| Root | Localhost.localdomain | Mima |
| Root | 127.0.0.1 | Mima |
| |          localhost | |
| |          Localhost.localdomain | |
+------+-----------------------+----------+

6, the above query out of the empty user delete:

mysql> Delete from user where user= ';

7, exit the database:

Mysql> quit

8, start the MySQL service:

# service MySQL Start

9. Re-use the order:

Mysql-u root-p

Login, ok!

For more information about MySQL interested readers can view the site topics: "MySQL Transaction operation skills Summary", "MySQL stored process skills encyclopedia", "MySQL database lock related skills summary" and "MySQL common function large summary"

I hope this article will help you with the MySQL database meter.

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.