-root ~]$ Mysql-uroot-p
Enter Password:
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
[Email protected] ~]$ mysql-uroot-p
mysql> use MySQL;
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a
Database changed
mysql> Update user Set Password=password (' 123123′) where user= ' root ';
Query OK, 0 rows affected (0.02 sec)
Rows matched:1 changed:0 warnings:0
Mysql> SHOW GRANTS for Root\g
1. Row ***************************
Grants for [e-mail protected]%: GRANT USAGE on *. * to ' root ' @ '% ' identified by PASSWORD ' *E56A114692FE0DE073F9A1DD68A00EEB9 703f3f1′
2. Row ***************************
Grants for [e-mail protected]%: GRANT all privileges on root_master
. * to ' root ' @ '% '
2 rows in Set (0.00
Mysql> Select User,host,password from Mysql.user order by User,host;
+ ————-+ ————— + ——————————————-+
| user | Host | password |
+ ————-+ ————— + ——————————————-+
| | Bj-root | |
| | localhost | |
| Root | % | *e56a114692fe0de073f9a1dd68a00eeb9703f3f1 |
| Root | 127.0.0.1 | *B335B8949A6AF011EA3D9F37F046C6E413BC23FB |
| Root | :: 1 | |
| Root | Bj-root | |
| Root | localhost | *B335B8949A6AF011EA3D9F37F046C6E413BC23FB |
| Weixin_user | % | *df81d3de3abc1508bfb0f1d4de9c2eecbae43e4f |
| Weixinuser | % | *df81d3de3abc1508bfb0f1d4de9c2eecbae43e4f |
+ ————-+ ————— + ——————————————-+
9 Rows in Set (0.00 sec)
Workaround, remove the user authorization as empty:
Mysql>
Mysql>
mysql> drop user "@ ' localhost ';
Query OK, 0 rows affected (0.04 sec)
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
mysql> drop User "@ ' bj-root′;
Query OK, 0 rows Affected (0.00 sec)
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
Mysql>
Mysql> Select User,host,password from Mysql.user order by User,host;
+ ————-+ ————— + ——————————————-+
| user | Host | password |
+ ————-+ ————— + ——————————————-+
| admin | % | |
| Root | % | *e56a114692fe0de073f9a1dd68a00eeb9703f3f1 |
| Root | 127.0.0.1 | *B335B8949A6AF011EA3D9F37F046C6E413BC23FB |
| Root | :: 1 | |
| Root | Bj-root | |
| Root | localhost | *B335B8949A6AF011EA3D9F37F046C6E413BC23FB |
| Weixin_user | % | *df81d3de3abc1508bfb0f1d4de9c2eecbae43e4f |
| Weixinuser | % | *df81d3de3abc1508bfb0f1d4de9c2eecbae43e4f |
+ ————-+ ————— + ——————————————-+
8 rows in Set (0.00 sec)
The reason is because there is a MySQL library user table has a null value when MySQL authentication, the match is empty value, so you can directly into the myql inside.
Blank password issues with MySQL authorized account permissions