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)05/31 Report--
The purpose of this article is to share with you how to forget the root password of mysql under linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. First make sure that the server is in a secure state, that is, no one can connect to the MySQL database at will.
Because during the period of resetting the root password for MySQL, the MySQL database is completely unprotected by the password
In this state, other users can log in and modify MySQL information at will. You can use the MySQL pair
The external port is closed, and the quasi-security of the server is realized by stopping Apache and all user processes.
Status. The safest state is to operate on the server's Console and unplug the network cable.
2. Modify the login settings of MySQL:
# vi / etc/my.cnf
Add a sentence to the paragraph of [mysqld]: skip-grant-tables
For example:
[mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
Skip-grant-tables
Save and exit vi.
3. Restart mysqld
# / etc/init.d/mysqld restart
Stopping MySQL: [OK]
Starting MySQL: [OK]
4. Log in and change the root password of MySQL
# / usr/bin/mysql
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 3 to server version: 3.23.56
Type 'help;' or'\ h' for help. Type'\ c'to clear the buffer.
Mysql > USE mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
Mysql > UPDATE user SET Password = password ('new-password') WHERE User =' root'
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
Mysql > flush privileges
Query OK, 0 rows affected (0.01 sec)
Mysql > quit
Bye
5. Modify the login settings of MySQL
# vi / etc/my.cnf
Delete the skip-grant-tables just added in the paragraph of [mysqld]
Save and exit vi.
6. Restart mysqld
# / etc/init.d/mysqld restart
Stopping MySQL: [OK]
Starting MySQL: [OK]
Thank you for reading! This is the end of the article on "how to forget the root password of mysql under linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out 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.