In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you a detailed introduction of mysql forgot password solutions and change the password of the three ways, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
1. Three ways to change the password
Mysql users are divided into root users (Super Admin, with all permissions) and ordinary users. Mysql server controls users' access to the database through permission tables, which are stored in the mysql database under root users.
In the process of using mysql database, you often need to change your password. Here are three ways to change your password:
1.1.Use the mysqladmin command to specify the new password mysqladmin-u root-p password 'new password' on the command line
Enter, you will be reminded to enter the original password
1.2.Use the set statement set password=password ("new password")
At this point, you need to restart the mysql server or use the flush privileges statement to refresh the permission table for the new password to take effect.
1.3.Modification of user table update mysql.user set authentication_string=PASSWORD ("123456") where user= "root" and host= "localhost"
Note that the field used to store the user's password in the new version of mysql is authentication_string instead of password, and the new password must be encrypted using the password function
Mysql8.0 modify password statement ALTER USER 'root'@'localhost' IDENTIFIED BY' ok'
If an error is reported, execute flush privileges first
2. What if I forget my password?
In addition, I wonder if my friends have ever forgotten their passwords? In fact, it's easy to forget your password, so here's how to solve it:
Step 1: enter the net stop mysql command on the command line to shut down the mysql service
Step 2: start the mysql service with the-- skip-grant-tables option (the server will not load permission judgment, and any user can access the database)
Enter mysqld-- skip-grant-tables on the command line
After the command runs, the user can no longer enter instructions. If you can see the process named mysqld in the task manager, you can log in to the server with the root user.
Step 3: open another command line window and enter the login command without a password
Mysql-u root
After a successful login, you can use the update statement to change the password
After the modification is completed, you must use the flush privileges statement to refresh the permission table so that the new password will take effect
Step 4: close the command line window where you enter the mysqld-- skip-grant-tables command, and then you can log in to the mysql server with the new password
The above is all the contents of this article entitled "detailed introduction of the solution of mysql forgetting password and three ways to change password". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.