Mac under the MySQL 5.7 change password

1. Turn off the MySQL service: System Preferences -> MySQL -> Stop MySQL Server;

2. enter the terminal, inputs an instruction into the installation directory:

cd /usr/local/mysql/bin/

3. Enter the command ($): Sign administrator privileges

sudo su

4. Enter the command (sh-3.2 #): Verification mysql prohibited. mysql service will automatically restart after the Run command (System Preferences can be seen in The MySQL Server Instance is running);

./mysqld_safe --skip-grant-tables &

5. Enter command ./mysql

Enter, enter the command FLUSH PRIVILEGES;

Enter, enter the command SET PASSWORD FOR 'root' @ ' localhost' = PASSWORD ( ' own set password');

6. logged in as root   mysql -u root -p

7. Enter the password just set up their own successful login

Guess you like

Origin www.cnblogs.com/xuyin/p/12113964.html