The following article mainly introduces the MySQL forgot root password correct solution, we all know in the actual operation forgot password is a very headache thing, the following is the correct solution for this problem, hope you will be harvested after browsing.
MySQL forgot root password solution:
1. Under Windows:
Open a command line window to stop the MySQL service: Net stop MySQL
Start MySQL, general to the installation path of MySQL, find Mysqld-nt.exe
Come to this directory:
C:/Program Files/mysql/mysql Server 5.0/bin>
Executive: Mysqld-nt--skip-grant-tables
In addition, open a command line window to execute MySQL
>use MySQL #选择数据库
1.>update User Set Passwordpassword=password ("New_pass") where user= "root";
2.>flush privileges;
3.>exit
With Ctrl+alt+del, find the mysqld-nt process kill it, restart the Mysql-nt service, you can log in with the new password
2.MySQL Forget root password solution:
Under Linux:
If MySQL is running, first kill: Killall-term MySQLd.
Start Mysql:bin/safe_mysqld--skip-grant-tables &
You can enter MySQL without the need for a password.
Then it's
1.>use MySQL
2.>update User Set Passwordpassword=password ("New_pass") where user= "root";
3.>flush privileges;
Re-kill MySQL, the normal way to start MySQL.
If MySQL is running, first kill: Killall-term MySQLd.
Start Mysql:bin/safe_mysqld--skip-grant-tables & (sometimes Mysqld_safe)
You can enter MySQL without the need for a password.
And then there's/usr/local/mysql/bin/mysql.
1.>use MySQL
2.>update User Set Passwordpassword=password ("New_pass") where user= "root";
3.>flush privileges;
Re-kill MySQL, the normal way to start MySQL.
The above related content is to MySQL forget root introduction, hope you can have some harvest.