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

Source: Internet
Author: User

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

Just installed on the server MySQL, found that the root plus password to always log in, and directly enter MySQL directly can login. or mysql–u root can be logged in, but the internship on the log on is also an empty user (' @ ' localhost '), not the root user, cannot see other databases.

dry, remove empty user method

1. Turn off MySQL

Service Mysqld Stop

Or

/etc/init.d/mysql 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;mysql> \q

4. Close all terminals, restart or turn on MySQL.

dry, set a password for root

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;mysql> \q
I'm the dividing line of the king of the land Tiger.

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

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.