After the system upgrade to MacOS 10.12 after starting MySQL, the terminal input MySQL error
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using password:yes/no)
Solutions
1Turn off MySQL in System Preferences
2$Cd/usr/bin
3$sudo mysqld_safe--skip-grant-tables
4Open a terminal again
$MySQL
Mysql>Use MySQL;
Mysql>UPDATE user SET Password=password (' 123456 ') WHERE user = ' root ';
OrUPDATE mysql.user SET password=password (' 123456 ') WHERE user= ' root ';
If your MySQL version is greater than 5.7 (can be entered in the terminal command:MySQL--versionView MySQL version number)
Enter this command:
UPDATE mysql.user SET authentication_string=password (' 123456 ') WHERE user= ' root ';
Last mysql>exit;
Start MySQL in System Preferences .
Reference Documentation:
http://stackoverflow.com/questions/13480170/access-denied-for-mysql-error-1045
Http://stackoverflow.com/questions/489119/mysql-error-1045-access-denied?rq=1
Upgrade to MacOS 10.12 mysqlb error 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)