In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to reset your password after forgetting your password under MySQL8. I hope you will get something after reading this article. Let's discuss it together.
The command line such as mysqld-skip-grant-tables cannot be started successfully in mysql8, and even if the parameter is tested in the ini file, it will not start either.
The password of MySQL is stored in the user table, and changing the password is actually changing the record in the table.
The idea of the reset is to find a way to enter the system without a password, and then use the database command to modify the password record in the table user.
After checking, the method recommended by the MySQL5 system on the Internet is to start the mysql service with the-skip-grant-tables parameter, which indicates that the authorization table is not loaded at startup, so root users can log in with an empty password after starting successfully.
Mysqld-skip-grant-tables
Can be used after login
UPDATE user SET authentication_string= "WHERE user='root'
This type of command sets the password or leaves the password empty.
However, the measured command line such as mysqld-skip-grant-tables cannot be started successfully in mysql8, and even if the parameter is tested in the ini file, it will not start either.
Two ideas of password reset in MySQL8 system
Two ideas, or use the-init-file parameter to load and run the command file to change the password when the service starts. Once the command is executed, the password has been cleared or reset after the service is started. After starting the service, you can log in with an empty password or a specified password.
Or continue to study the reason why the service cannot be started under the-skip-grant-tables command line parameter, solve the problem, and then log in with an empty password after starting the service, enter the command manually, clear or reset the password record field in the mysql.user table.
The former is recommended.
The specific operation procedure is as follows:
Method 1: use the-init-file parameter to solve the problem
This parameter specifies that a file containing the sql command is executed when the service starts, so you only need to write the command to reset the password in this file, use this parameter to specify that the command is executed at startup, and the system password can be reset when startup is complete.
Step one, turn off the system service.
Net stop mysql
The second step is to create a text file with a password change command
ALTER USER 'root'@'localhost' IDENTIFIED BY "
Step 3: start the server on the command line and specify to execute the above password modification command file at startup
Mysqld-init-file=d:mysqlc.txt-console
Screenshot of specific operation
Method 2, find a way to make the-skip-grant-tables parameter work.
In the first way, turn off the system service first.
It is measured that under the mysql8 system, the service can be started without a password with mysqld-console-skip-grant-tables-shared-memory.
After the service starts, log in to the system with an empty password
Mysql.exe-u root
Then execute the sql command to set the root user password to empty
UPDATE mysql.user SET authentication_string= "WHERE user='root' and host='localhost'
Screenshot of specific operation
Due to some characteristics of MySQL8, the old method reset is not very effective. It is recommended to use the-init-file parameter to solve the problem, which is safe and reliable in the actual measurement.
After reading this article, I believe you have a certain understanding of "how to reset your password after you forget your password under MySQL8". If you want to know more about it, please follow the industry information channel. Thank you for your reading!
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.