one, can log in the changes, limited to the software recorded the password but I forgot
Method 1: Use the Set password command
Log in to MySQL first.
Format:mysql> set password for user name @localhost = password (' new password ');
Example:mysql> set password for [email& Nbsp;protected] = password (' 123 ');
Method 2: Mysqladmin
Format: mysqladmin-u User name- P Old password password new password
Example: mysqladmin-uroot-p123456 password 123
Method 3: Edit the user table directly with update
Log in to MySQL first.
mysql> use mysql;
mysql> Update user set Password=password (' 123 ') where user= ' root ' and host= ' localhost ';
mysql> flush privileges;
Second, unable to log on modify mode, limited to have permission to modify the MySQL installation file ()
Method 4: When you forget the root password, you can
take windows as an example:
1. Enter the MySQL installation directory to open the My.ini file
2. Locate the [mysqld] configuration line ( note, not [MySQL]), and enter it on the following line: Skip-grant-tables ( or:--skip-grant-tables, The difference is that sometimes two dashes will cause the service to fail to restart and the test should add No. )
3.cmd command: services.msc, find MySQL service and reboot ( make modified configuration file effective )
4.mysql command line: Use MySQL ( enter system Configuration library )
5.mysql command line: Update user set Password=password ("123") where user= "root"; ( don't forget the last semicolon, the semicolon means the end of the command )
6.mysql command line: Flush privileges; ( flush cache, update database read password do not forget the last semicolon, semicolon means the end of the command )
7. Log out of MySQL or restart the service and the password is set successfully.
MySQL forgot root password solution