MySQL 5.7+ After the installation is successful, a temporary password is required to set up a new password after the temporary password
重置root密码:
安装成功后,使用临时密码登陆:敲入命令,mysqladmin -u root -p password
这时会提醒你输入密码,输入临时密码登陆成功后,会再提醒你修改密码,修改完成后你就可以正常登陆了。
If you do not have a password saved there are two ways to reset the root password:
1. Uninstall reinstall below there is uninstall method dmg file inside No uninstall can only be installed manually
卸载方式:(Mac)
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
vim /etc/hostconfig (and removed the line MYSQLCOM=-YES-)
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
2. Security Update root password to be honest this way I'm not good (embarrassed)
MySQL Change password
System Preferences->mysql->stop MySQL Server
1
|
Jacob@JacobdeMacBook-Pro: ~$ sudo mysqld_safe--skip-grant-tables
|
Re-open a terminal into the MySQL console
1 2 3 4 5 6 7 8 9 10 11 12
|
[Email protected]:~$ mysql-u Root Welcome to the MYSQl monitor. Commands End With; or \g. your MySQL connection ID was 3 server VERSION:5.7.7-RC MySQL Community server (Gpl) copyright and/or its affiliates. All rights reserved. oracle is a registered trademark of Oracle corporation and/or its affiliates. Other names is trademarks of their respective owners. type ' help; ' /span> |
Prompt has successfully entered the console
Modify password, sql
statement
1
|
Set Password=password (where user=' root ';
|
The place of the pit daddy comes, the following error is entered
God horse situation, ‘password‘
column does not exist, this place spent a lot of time, the reason is actually very simple ah ah.
The user
password field column name in the table in MySQL version 5.7 has changed, and it has password
becomeauthentication_string
You can look directly at user
The fields in the table
1 2
|
mysql> use MySQL; mysql> desc user;
|
Some fields are as follows
Field |
Type |
Null |
Key |
Default |
Extra |
Host |
CHAR (60) |
NO |
Pri |
|
|
User |
CHAR (16) |
NO |
Pri |
|
|
Authentication_string |
Text |
YES |
|
Null |
|
Password_expired |
Enum (' N ', ' Y ') |
NO |
|
N |
|
Password_last_changed |
Timestamp |
YES |
|
Null |
|
Password_lifetime |
smallint (5) unsigned |
YES |
|
Null |
|
Finally, use the following statement to modify
1 2 3 4 5 6 |
mysql> update MySQLset Authentication_string=password (where user=' root '; 1 Warning (0.00 sec) 1
mysql> flush Privileges; Rows Affected (0.00 sec)
|
The modification succeeds and enters the console again
This time we can go in, but the execution of a statement is still an error.
Follow the prompts to set the password again
1 2
|
For root@localhost =password (' 12345 '); Warning (0.00 sec)
|
Easy setup
For easy use of MySQL
Mac EI 10.11.3 MySQL5.7.11. DMG installation (easy setup, password reset, uninstall)