In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following is about how the MySQL database forgets the root password to reset and modify. The secret of the text lies in being close to the topic. So, no gossip, let's go straight to the following, I believe that after reading the MySQL database to forget how to reset the root password to change this article you will certainly benefit.
Method 1: use the SETPASSWORD command
MySQL-uroot
Mysql > SET PASSWORD FOR'root'@'localhost' = PASSWORD ('newpass')
Method 2: use mysqladmin
If root has already set a password, use the following method to mysqladmin-u root password "newpass"
Mysqladmin-u root passwordoldpass "newpass"
Method 3: edit the user table directly with UPDATE
Mysql-u root
Mysql > use mysql
Mysql > UPDATE user SETPassword = PASSWORD ('newpass') WHERE user =' root'
Mysql > FLUSH PRIVILEGES
Method 4: when you forget your root password, you can manipulate the database as follows:
Step 1: stop the database first and execute the following command:
If you install mysql using apt-get or yum, you can execute the mysql.serverstop command directly.
If the database is compiled and installed, you need to go to the command directory bin/ of mysql
Execute:. / mysql.server stop or servicemysqld stop
Step 2: modify my.cnf
Open the mysql configuration file my.cnf using the vim command
Add skip-grant-tables to the mysqld process configuration file, and after the addition is complete, perform a wd save.
Step 3: restart the database
Restart the database using the command line tool
Service mysqld restart
Step 4: change the root password
After restarting the database, you can log in directly without a password:
Mysql-u root mysql
Mysql > UPDATE user SET password=PASSWORD ("new password") WHERE user='root'
Mysql > FLUSH PRIVILEGES
# change the newpassword character in password () to your own password.
Mysqld_safe--skip-grant-tables&
Mysql-u root mysql
Mysql > UPDATE user SETpassword=PASSWORD ("new password") WHERE user='root'
Mysql > FLUSH PRIVILEGES
Step 5: restart the database
After the password modification is completed, comment or delete the skip-grant-tables statements added in the my.cnf file, and then restart.
Is there anything you don't understand about how the above MySQL database forgets the root password to reset and modify the relevant content? Or if you want to know more about it, you can continue to follow our industry information section.
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.