In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains how to reset the root password without a password 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 "mysql does not need a password to reset the root password"!
MySQL reset root password
We introduce a way to reset root passwords without a password.
The steps are as follows:
1. Open the configuration file / etc/my.cnf, and add a line skip-grant-tables under mysqld, as follows:
[mysqld] #... skip-grant-tables#...
So we can log in to MySQL without secret access.
Then save and exit.
2. Restart MySQL
Choose 1 for these two commands:
$sudo systemctl restart mysqld$ sudo service mysqld restart
3. Enter mysql at the terminal to log in to the MySQL database directly:
$mysql
Successfully entered mysql
Switch to the MySQL system library mysql:
Mysql > use mysql
5. Reset the root password
It is important to note that after MySQL5.7, there is no password field.
The password field has been changed to authentication_string.
To change the password we want to change the value of this field.
Update user set authentication_string=password ('new password') where user='root'
In this way, we have successfully changed the password.
5. Modify the / etc/my.cnf file to comment out the sentence "skip-grant-tables" that was added before.
Otherwise, we will still log in to Mysql in a secret-free way.
6. Restart MySQL again and you are done.
At this point, I believe you have a deeper understanding of "mysql does not need a password to reset root password". 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.