In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what to do after adding users in Mysql?", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what to do if an error occurs after adding users in Mysql"!
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:
At this point, I believe you have a deeper understanding of "what to do when you report an error after adding users in Mysql". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.