Reset operation after MySQL forgot password

Source: Internet
Author: User

First, modify the configuration file mode
1. Turn off MySQL
Linux:
1) Service mysqld stop
2)/usr/local/mysql/support-files/mysql.server Stop
Windows:
1) Execute net stop MySQL at the command prompt
2) Computer Right-click Management Services, find the MySQL service, stop this service
2. Modify the configuration file
Linux configuration file is my.cnf, under Windows configuration file is My.ini, under [mysqld] Add
Skip-grant
3. Restart MySQL
Linux:
1) Service mysqld start
2)/usr/local/mysql/support-files/mysql.server Start
Windows:
1) Execute net start MySQL at the command prompt
2) Computer Right-click Management Services, find MySQL service, start this service
4. Enter MySQL
Linux:
/usr/local/mysql/bin/mysql-u root-p into MySQL
Windows:
D:/mysql/mysql-u root-p into MySQL, where D:/mysql is the MySQL installation directory

5. Change your password
Execute the following statement
Use MySQL;
UPDATE user SET Password=password ("XXX") WHERE user= "root"; where xxx is the password you want to set
Flush privileges;
Exit
6, remove the skip-grant in the configuration file
7. Restart MySQL

Ii. Command mode (for Linux)
1. Turn off MySQL
1) Service mysqld stop
2)/usr/local/mysql/support-files/mysql.server Stop
2. Execute the following command
/usr/local/mysql/bin/mysqld_safe--skip-grant
3. Enter MySQL
/usr/local/mysql/bin/mysql-u root-p into MySQL
4. Change your password
Execute the following statement
Use MySQL;
UPDATE user SET Password=password ("XXX") WHERE user= "root"; where xxx is the password you want to set
Flush privileges;
Exit
5. Restart MySQL

PHPmyadmin 2.11.3+2.11.4 Universal password localhost ' @ ' @ ' only need to enter the account password do not need to enter

Reset operation after MySQL forgot password

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.