It is best to forget the mysql password _ MySQL

Source: Internet
Author: User
The best solution for forgetting the mysql password is bitsCN.com.

In windows:

Open the command line window and stop the mysql service:
Net stop mysql
Start mysql, usually to the installation path of mysql, find the mysqld-nt.exe (or mysqld.exe)
Run: mysqld-nt (or mysqld.exe) -- skip-grant-tables. the current window will stop.
In addition, open a command line window and execute mysql. if the command is not displayed, first enter the BIN directory of the MYSQL installation location and then run mysql.

>use mysql >update user set password=password("new_password") where user="root"; >flush privileges; >exit

Use Ctrl + Alt + Del to find the mysqld-nt process and kill it. after restarting the mysql-nt service, you can log on with the new password.

In linux:

If MySQL is running, killall-TERM mysqld is first killed.
Start MySQL: bin/safe_mysqld -- skip-grant-tables &
You can access MySQL without a password.
Then

>use mysql >update user set password=password("new_pass") where user="root"; >flush privileges;

Kill MySQL again and start it in normal mode

Replace with the MYSQL database of the same version: (make sure to back up the database first)
1. reinstall the same version of MySQL on another computer.
2. delete all/data/MySQL contents in the mysql installation directory on the computer with the password forgotten (stop the MySQL service first)
3. Copy all/data/MySQL contents in the mysql installation directory on the newly installed computer to the directory you just deleted
4. start the MySQL service.

BitsCN.com

The above is the best solution to forget the mysql password _ MySQL content. For more information, please follow the PHP Chinese network (www.php1.cn )!

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.