Small white users, the first installation of 5.7.13, just beginning some Mongolian, change the password is a hole, fortunately or solved, record a journey:
Installation process is very simple, directly to the official MySQL DMG, the next step can be installed. Ps:
Before the installation is complete there will be a prompt to generate a root temporary password, which should be remembered (this figure is borrowed online):
Mysql-uroot-p Use the temporary password to log in.
k$ Mysql-u Root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
After the successful login, hit a command to see it, the result is tragic:
mysql> show databases;
ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.
On the internet a variety of search and change the password problem, the results of the tangle of the majority of days have not changed, because there is a file written ambiguous, it may be due to the wrong version, (or I will not search +_+) So this is why I write down.
In fact, the solution is very simple, three steps to fix:
1: mysql> SET PASSWORD = PASSWORD (' abcd_1234 '); #括号里密码是你要设置的密码
Query OK, 0 rows affected, 1 Warning (0.00 sec)
2:mysql> ALTER USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;
Query OK, 0 rows Affected (0.00 sec)
3: mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
Re-open a terminal, login with the new password:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| SYS |
+--------------------+
4 rows in Set (0.01 sec)
Mac install MySQL 5.7.13 Version login and password change