Linux/Mac What should I do if I forget my password for MySQL? This article mainly introduces the solution to the MySQL forgotten password. The command line modification has certain reference value. Interested friends can refer to
Linux/Mac What to do if MySQL forgets the password? Don’t worry, here’s how to change your password using the command line.
All prerequisites require root permissions
1. End the mysql process
//Linux sudo services mysql stop //Mac brew services stop mysql
2. Mysql runs in the background
##
mysqld_safe --skip-grant-tables & mysql
3. Change the password
use mysql; update user set password = password("新密码") where user='root'; flush privileges;
mysqladmin -u root -p oldpassword "newpassword"
The above is the detailed content of What to do if you forget your password for Linux/Mac MySQL. For more information, please follow other related articles on the PHP Chinese website!