After installing MySQL on a Mac, log on to the local data connection via navigate and find no password, and no password was set during the installation of MySQL. In fact, just installed, there is an interface, assigned an initialization of the password, maybe everyone like me, directly click on the jump past, have not saved, so it is necessary to just install the MySQL reset new password;
Directly on the solution, the command line is used directly as a:
One, the first step: Stop the MySQL service.
To turn off the operation of the MySQL service:
The bottom point of the system Preferences, Apple-, MySQL close MySQL service on the popup page (click stop mysql server
)
Second, step two: Enter the terminal, instructions to restart the MySQL service.
0. Open the terminal:
1. Enter: cd /usr/local/mysql/bin/
2. Enter: sudo ./mysqld_safe --skip-grant-tables
3, enter the command 2, will prompt for password: (Mac account root user password)
4, then you will find that MySQL will automatically restart
Step three: Open a different terminal, set up the MySQL password.
1. Enter:cd /usr/local/mysql/bin/
2. Enter: ./mysql
3. Input:mysql> FLUSH PRIVILEGES;
4. Set the password admin123
Input:mysql> SET PASSWORD FOR ‘root‘@‘localhost‘ = PASSWORD(‘admin123‘);
That's all. Thank
Mac install MySQL set initial password