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