When we use the mysql database, if we forget the password, the following picture will be displayed
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password : YES)
Generally speaking, we have two solutions. One is to uninstall and reinstall, and to skip the password verification and change the password is obviously the same. A more convenient option. The steps of this method are as follows:
1. Close the mysql server
##1. Find the bin directory path in the mysql installation pathFind mysql in the computer "Services" and double-click to find the corresponding path 2. Open the command line with administrator rights and jump to the bin directory path under the installation path. At #3. Enter the command on the command line to skip the password verification of mysql
mysqld --console --skip-grant-tables --shared-memoryThe mysqld command is in the bin directory. This command can only be executed if the command line jumps to the bin directory. Do not close this window after entering the command 4. Open another dos command window with administrator rights and enter the login command
mysql -u root -pClick
directly at the command input
5. Use the sql command to jump to mysql table and change the password 6. Enter the flush privileges command and exit 7. Close all command lines window, and re-open a dos window as an administrator. 8. Restart the mysql server 9. You can use the set password to access the mysql serverThe above is the detailed content of What is the method to reset mysql forgotten password?. For more information, please follow other related articles on the PHP Chinese website!