Home  >  Article  >  Database  >  MySQL two unconventional ways to reset password tutorial

MySQL two unconventional ways to reset password tutorial

零下一度
零下一度Original
2017-05-08 14:59:061144browse

What should I do if I forget the MySQL administrator password?

If you forget the login password of your MySQL account, MySQL provides two unconventional ways to reset the password.

The first method is to add parameters (--init-file) when starting the MySQL service and execute a script containing a reset password to modify the account password.

The second method is to add special parameters when starting MySQL to skip permission detection when starting MySQL, then log in to MySQL to change the password of the account, and finally start MySQL in the normal way.

I have actually used the second method. Let me introduce the second method in detail.

The first step is to start MySQL with special parameters. The command on windows is as follows:

mysqld --skip-grant-tables --skip-networking&

--skip-grant-tables’s function is Make MySQL start by bypassing permission detection. Starting MySQL this way, anyone can connect to MySQL without a password. This is not allowed. The function of --skip-networking is to prevent the MySQL service from listening to requests from TCP/IP, that is, the MySQL service cannot be connected to the network.

The command on linux is as follows:

mysqld_safe --skip-grant-tables --skip-networking&

th The second step is to log in to MySQL without using the account password and change the account password. The command is as follows:

update mysql.user set password=password('123456') where user='system';

The third step is to shut down the MySQL service, and then start MySQL in the normal way. The command is as follows:

mysqladmin shutdown
mysql_safe

【 Related recommendations】

1. Free mysql online video tutorial

2. MySQL latest manual tutorial

3. database design those things

The above is the detailed content of MySQL two unconventional ways to reset password tutorial. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn