Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if I forget my MySQL login password?

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Let me tell you a little bit about how to forget your MySQL login password. Have you ever learned about similar topics before? If you are interested, let's take a look at this article. I believe it is more or less helpful for everyone to forget what to do after reading the MySQL login password.

Method 1:

1. You can add skip-grant-tables to the configuration file-notice that under the [mysqld] parameter group, you can skip authorization 2, restart MySQL and then log in without a password. Go in and change the password. After the change, flush privileges can log in with the new password (for example: update mysql.user set password=password ("123") where user= "root" and host= "localhost" ) 3, remember to remove the skip-grant-tables of the configuration file example, restart 4, and then log in with the new password

Method 2:

If MySQL is not started, [root@mysql ~] # mysqld_safe-- skip-grant-tables &-- use this command to start and log in directly without a password. After entering, you can change the password if an error occurs when the command cannot be found-bash: mysqld_safe:command not found enter the mysql directory: cd / usr/local/mysql/ (I installed this from the source package) and then run: bin/mysqld_safe-- skip-grant-tables &

Three methods of changing password

Mysqladmin-u root password '456'-p123-- to change the password in clear text, you need the original password (mysqladmin-u root password-p). Do not want to change the password in clear text. Enter password:-- hide enter the original password New password:-- hide enter the new password Confirm new password:-- hide and confirm the new password

The second kind:

Enter the database to modify the password 1, update mysql.user set password=password ("789") where user= "root" and host= "localhost";-- use SQL statements to directly modify the user password table inside the database 2, flush privileges;-- remember to refresh the permission table after changing the password

The third kind:

Enter the database to change the password

Set password for 'root'@'localhost'=password (' 123');-- use this operation statement to change the password without refreshing the permission table

People think that the MySQL login password has forgotten how to do this article, and whether it has gained anything. If you want to know more about it, you can continue to follow our industry information section.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report