ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '

Source: Internet
Author: User
Tags anonymous

Install MySQL under CentOS, with the root account of MySQL, see the database results only Information_schema library, my original library and MySQL library are missing, and then execute the use MySQL prompt error, as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/8B/E3/wKiom1hbhNPQjjPZAAAS9DMyBJQ066.jpg "title=" 1482392754 (1). jpg "alt=" wkiom1hbhnpqjjpzaaas9dmybjq066.jpg "/>

mysql> use MySQL; ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '

Tip: ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '. On the internet to find a more popular method (see method one), done. Today again with this try, but do not make, in the Internet to find a half-day, finally found that because of the MySQL database user table, there is a username is empty account is anonymous account, resulting in the time of login is the root, but the actual is anonymous login, through the error prompt "@" LocalHost ' can be seen, so the solution to see method two.

method One:
1. Turn off MySQL
# Service Mysqld Stop
2. Blocking Permissions
# Mysqld_safe--skip-grant-table
Screen appears: Starting demo from .....
3. Start a new terminal input
# mysql-u Root MySQL
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
Mysql> FLUSH privileges;//Remember to say this, otherwise if you close the previous terminal, the original error will appear
Mysql> \q

Method Two:
1. Turn off MySQL
# Service Mysqld Stop
2. Blocking Permissions
# Mysqld_safe--skip-grant-table
Screen appears: Starting demo from .....
3. Start a new terminal input
# mysql-u Root MySQL
mysql> Delete from user where user= ';
Mysql> FLUSH privileges;//Remember to say this, otherwise if you close the previous terminal, the original error will appear
Mysql> \q



This article from "Rookie also want to fly" blog, please be sure to keep this source http://xiumin.blog.51cto.com/6205237/1885116

ERROR 1044 (42000): Access denied for user "@ ' localhost ' to database ' MySQL '

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.