MySQL Error 1045 (28000) errors occurred

Source: Internet
Author: User

The first step:

Using this method to experiment, I found that this is not the case because I have no empty user:

First, the phenomenon: the MySQL database of the company Linux system root user set password, but often with the command ' mysql-u root-p ' login error, and sometimes can log in. Login error message: [[[email protected] ~]# mysql-u root-penter password:error 1045 (28000): Access denied for user ' root ' loc Alhost ' (using Password:yes) Two, reason: the existence of empty users in the database three, processing methods: 1, disable MySQL service: # service MySQL stop2, input command: # Mysqld_safe--user=mysql- -skip-grant-tables--skip-networking & 3, log in database: # mysql-u root mysql4, mysql> use mysql;5, mysql> select User,hos T,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, remove the empty user from the above query:mysql> delete from user where user= '; 7, exit database: MySQL > quit8, start MySQL service: # service MySQL Start9, re-use command ' Mysql-u root-p' Login, ok! 

But there's another way to log in without a password: Add a line to/ETC/MYSQL/MY.CNF

Yes, that's right. Add Skip-grant-tables

Then sudo service MySQL restart

Step Two:

Looking for new ways to Http://www.bitscn.com/pdb/mysql/201407/226146.html

MySQL Error 1045 (28000) errors occurred

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.