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 )!