Mysql, ERROR 1044 (42000): Access denied for user & #39; & #39; @ & #39; localhost & #39; to database & #39; mysql & amp; #39;, 104442000

Source: Internet
Author: User

Mysql, ERROR 1044 (42000): Access denied for user ''@ 'localhost' to database 'mysql', 104442000

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

I just installed mysql on the server and found that I could not log on using the root and password method, but directly entered mysql to log on directly. You can also log on to the mysql-u root mode, but it is also an empty user ('@ 'localhost') When you log on to the internship. It is not a root user and cannot identify other databases.

Dry Goods: how to delete empty users

1. Disable mysql

service mysqld stop

Or

/etc/init.d/mysql stop

2. Block Permissions

mysqld_safe --skip-grant-table

The screen displays: 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 enable mysql.

Dry Goods, set password for root

1. Disable mysql

service mysqld stop

2. Block Permissions

mysqld_safe --skip-grant-table

The screen displays: 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 am the dividing line of tiantiao

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.