In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what MySQL password change methods, I believe that most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
The following methods are available
(recommended course: MySQL tutorial)
The first way:
The easiest way is to modify it with the help of a third-party tool, Navicat for MySQL, as follows:
1. Log in to mysql to the specified library, for example, log in to test library.
2. Then click the user button above.
3. Select the user name you want to change, and then click the "Edit user" button above.
4. if the interface appears as shown in the picture, enter the new password, confirm the new password, and click the "Save" button.
The second way:
Method 1: use the SET PASSWORD command
Log in to MySQL first.
Format: mysql > set password for username @ localhost = password ('new password')
Example: mysql > set password for root@localhost = password ('123')
Method 2: use mysqladmin
Format: mysqladmin-u username-p old password password new password (note: there is no space between-p and the old password, there is a space between the password and the new password)
Example: mysqladmin-uroot-p123456 password 123
Method 3: edit the user table directly with UPDATE
Log in to MySQL first.
Mysql > use mysql; mysql > update user set password=password ('123') where user='root' and host='localhost'; mysql > flush privileges; method 4: you can do this when you forget your root password
Take windows as an example:
1. Shut down the running MySQL service.
two。 Open the DOS window and change to the mysql\ bin directory.
3. Enter mysqld-- skip-grant-tables enter. Skip-grant-tables means to skip authorization table authentication when starting the MySQL service.
4. Open another DOS window (because the DOS window just now cannot be moved), and change to the mysql\ bin directory.
5. Enter mysql enter, and if successful, the MySQL prompt > will appear.
6. Connect permissions database: use mysql;.
6. Change the password: update user set password=password ("123") where user=" root "; (don't forget to add the semicolon at last).
7. Refresh permissions (required): flush privileges;.
8. Exit quit.
9. Log out of the system, enter again, and log in with the user name root and the new password 123 you just set.
The third way:
1. Open the folder where mysql.exe and mysqld.exe are located, and copy the path address
2. Open the cmd command prompt and enter the folder where mysql.exe is located in the previous step.
3. Enter the command mysqld-- skip-grant-tables enter, and the user verification of mysql is skipped. Note that after entering this command, the command line is inoperable, and you can open a new command line at this time. Note: end the mysqld.exe process in the task manager before entering this command to make sure that the mysql server side has finished running.
4. Then enter mysql directly, and you can log in to the database without any login parameters.
5. Enter show databases; to see all the database instructions that have successfully logged in.
The mysql library is where the user name is saved. Enter use mysql; to select the mysql database.
Show tables looks at all the tables and finds a user table that stores account information such as user name, password, permissions, and so on.
Enter select user,host,password from user; to view the account information.
Change the root password and enter update user set password=password ('123456') where user='root' and host='localhost'
Check the account information again and select user,host,password from user; can see that the password has been changed.
Exit the command line, restart the mysql database, and try to log in with the new password.
The test logs in to mysql without a password, and it is found that it can still log in, but only two databases can be seen when the database is displayed, indicating that the password verification skipped after reboot has been cancelled.
The reason why I was able to log in without a password after rebooting the database is that there is an account in my database that does not need a password.
Matters needing attention
Pay attention to several places where the database needs to be restarted
The above are all the contents of MySQL's method of changing password. Thank you for your 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.