In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor
Error description: after adding a user to Mysql, there may be an error that prompts ERROR 1045 (28000): Access denied for user when logging in. Delete the value NULL in user.user, or update the NULL to test 1) delete from user where user is NULL 2) update user set user='test' where user is NULL. Unexpected situation: if the above method does not work and there are still empty users, you can use graphical user client to delete.
After reinstalling CentOS, I found that Mysql has not been easy to use.
# mysqladmin create dbname command always returns mysqladmin: connect to server at 'localhost' failed
# mysql-u root@localhost
> create database dbname
Also return error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
# mysql-u root-p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Use the method described online to change the password of a root user:
# mysqladmin-uroot-p password' newpassword'
Enter password:
Mysqladmin: connect to server at 'localhost' failed
Error: 'Access denied for user' root'@'localhost' (using password: YES)'
Now I have finally found the solution, as follows (please test method 3 first, thank you! ):
Method 1:
# / etc/init.d/mysql stop
# mysqld_safe-user=mysql-skip-grant-tables-skip-networking &
# mysql-u root mysql
Mysql > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root'
Mysql > FLUSH PRIVILEGES
Mysql > quit
# / etc/init.d/mysql restart
# mysql-uroot-p
Enter password:
Mysql >
Method 2:
Directly use the username and password provided in the [client] section of the / etc/mysql/debian.cnf file:
# mysql-udebian-sys-maint-p
Enter password:
Mysql > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root'
Mysql > FLUSH PRIVILEGES
Mysql > quit
# mysql-uroot-p
Enter password:
Mysql >
Method 3:
I have not tested this method, because my root user's default password has been changed by me. That one is free to test it and tell me the result. Thank you!
# mysql-uroot-p
Enter password:
Final note: don't forget to turn off the firewall, lest the external network cannot access the database port of the host.
At this point, the problem that has been confused for a long time has been solved!
If you reprint it, please indicate the source of Weili blog: http://www.wangweilin.name/rj_446.html
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.