In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how mysql changes passwords through cmd. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Methods: 1, use "SET PASSWORD FOR 'root'@'localhost'=PASSWORD (' newpass');" command; 2, use "mysqladmin-u root password oldpass" newpass ".
Mysql's method of changing the password through cmd:
Initialize and set the password
/ etc/init.d/mysql stop cd / usr/local/mysql mysqld_safe-user=mysql-skip-grant-tables-skip-networking & mysql-u root mysql mysql > UPPATE user SET password=PASSWORD ('newpassword') where USER='root'; mysql > FLUSH PRIVILEGES; mysql > quit; / etc/init.d/mysql restart mysql-u root-p
Method 1: use the SET PASSWORD command
Mysql-u root mysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' newpass')
Method 2: use mysqladmin
Mysqladmin-u root password "newpass"
If root has already set a password, use the following methods
Mysqladmin-u root password oldpass "newpass"
Method 3: edit the user table directly with UPDATE
Mysql-u root mysql > use mysql; mysql > UPDATE user SET Password = PASSWORD ('newpass') WHERE user =' root'; mysql > FLUSH PRIVILEGES
2. When the root password is lost, set the root password
Method 1:
Mysqld_safe-skip-grant-tables& mysql-u root mysql mysql > UPDATE user SET password=PASSWORD ("new password") WHERE user='root'; mysql > FLUSH PRIVILEGES
Method 2:
1. Modify the configuration file of mysql (default is / etc/my.cnf), and add a line skip-grant-tables under [mysqld].
2. Restart the mysql service service mysqld restart after saving the configuration file
3. Log in to mysql with mysql-u root-p, enter directly without entering the password, and then change the password according to the above process.
4. After the password has been modified, delete the line in the configuration file in process 1, and then restart the mysql service
So much for sharing about mysql's method of changing passwords through cmd. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.