MySQL forgot password, how to reset Password

Source: Internet
Author: User

Method, teach you two strokes to reset the root password!
1. Use mysqladmin to modify the MySQL password
c:\>mysqladmin-udbuser-p password newpass
Enter password:oldpass
Of course, the premise of using this command is that you add MySQL to the environment variable, if you do not add environment variables, it can only be in the command line CD to the mysqladmin in the

directory with this command!

2. Reset the root password
method one:
in the My.ini [mysqld] field join:
skip-grant-tables
Restart the MySQL service when MySQL does not require a password to log on to the database
Then go to MySQL
mysql>use MySQL;
Mysql>update user Set Password=password (' New password ') whereuser= ' root ';
Mysql>flush privileges; After the
is run, remove the skip-grant-tables from the My.ini and restart the mysqld.
Modify MySQL Password method two:
Do not use the method of modifying the My.ini restart Service, through the non-service mode plus skip-grant-tables run MySQL to modify the MySQL password
Stop MySQL service
Open a command-line window, Start with Mysqld-nt.exe in the bin directory, i.e. execute in command-line window: Mysqld-nt--skip-grant-tables
Then open a command-line window and log in to MySQL without entering the MySQL password.
After the password is modified as above, close the command line to run MySQL window, this time the MySQL is turned off, if you find that MySQL is still running can end

off the corresponding process to shut down.
Start the MySQL service

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.