How to reset the root password:
Under Windows system:
1, stop the MySQL service;
2, the new file Init-root.txt, write the following content:
Update mysql.user Set password = password (' newpwd ') where user = ' root ';
Flush privileges;
Save
3. Open the command line and enter: C:\mysql\bin\mysqld--init-file=c:\\mysql-init.txt
The--init-file option points to the initialized file
If MySQL is installed through the GUI Interface Installation Wizard, the following:
C:\> "C:\Program files\mysql\mysql Server 5.6\bin\mysqld.exe"
--defaults-file= "C:\\Program Files\\mysql\\mysql Server 5.6\\my.ini"
--init-file=c:\\mysql-init.txt
--defaults-file options point to MySQL configuration file
4, after the service restart password has been reset, you can delete the Init-root.txt file.
Linux, the first method is similar to Windows:
1, stop the MySQL service (kill process);
2, the new file Init-root, write the following content:
Update mysql.user Set password = password (' newpwd ') where user = ' root ';
Flush privileges;
Save
3. Running in the shell: Mysqld_safe--init-file=/home/me/mysql-init &
4, the service restarts, you can delete the Init-root.txt file.
Methods available on all platforms:
1, Stop mysqld service,
2, configuration my.conf file, join:--skip-grant-tables option, skip permission check;--skip-networking option to block remote client network connection;
3, restart the MYSQLD service,
Shell> Service mysqld Start
4, Login client,
shell> MySQL
5. Change Password:
mysql> Update mysql.user Set password = password (' newpwd ') where user= ' root ';
mysql> flush Privileges;
6. Close Mysqld Service, remove--skip-grant-tables and--skip-networking options, restart service
Reference:
MySQL Official documentation:
Http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html
Several ways MySQL resets the root password (windows+linux)