Blank password issues with MySQL authorized account permissions

Source: Internet
Author: User

-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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.