Forgot MySQL password processing method (Linux,windows)

Source: Internet
Author: User
Tags mysql tutorial

Forget MySQL Tutorial password processing method (Linux,windows)
Here is a description of the MySQL password processing method, mainly in the different operating systems such as Linux and Windows to retrieve the password method

#/etc/init.d/mysql Stop
# Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
# mysql-u Root MySQL
mysql> Update user Set Password=password (' NewPassword ') where user= ' root ';
mysql> flush Privileges;
Mysql> quit
#/etc/init.d/mysql Restart
# mysql-uroot-p
Enter Password: < Enter the new password newpassword>
Mysql>

Windows forgot MySQL password processing method

1, edit the MySQL configuration file:

Windows environment:%mysql_installdir%my.ini//General MySQL installation directory under the My.ini is the configuration file.

Linux Environment:/ETC/MY.CNF

Add the following line to the [MySQLd] configuration segment:
Skip-grant-tables

Save exit Edit.

2, and then restart the MySQL service

In the Windows environment:
net stop MySQL
net start MySQL

In Linux environments:
/etc/init.d/mysqld restart

3, set the new root password

And then execute at the command line:
Mysql-uroot-p
Direct return without a password to enter the database tutorial.

On entering the MySQL table
Use MySQL;

Then execute the following statement to update the root password to 123456:
Update user set Password=password ("123456″") where user= ' root ';

Quit Exit MySQL

4, restore the configuration file and restart the service
Then modify the MySQL configuration file to remove the line that you just added.
Reset MySQL service again, password modified

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.