MySQL 5.1 because the user with host localhost is empty and the password is empty, the local user cannot log on.

Source: Internet
Author: User

Do not say. Directly on the MySQL user data, the fourth column, the host is localhost, the user is empty, the password is empty.

result in the local login in addition to the root of the account, other accounts do not need a password to log in, and affect the host as% of users landing.

You only need to delete the corresponding line.


mysql> Delete from user where host= ' localhost ' and user= ';
Query OK, 1 row Affected (0.00 sec)

I tried this here. User is NULL, seemingly unsupported. cannot be deleted.

Sql> SELECT * from user \g;
1. Row ***************************
Host:localhost
User:root
Password: *698756c099abd932c2f76c4a69c24608e8460b75
Select_priv:y
Insert_priv:y
Update_priv:y
Delete_priv:y
Create_priv:y
Drop_priv:y
Reload_priv:y
Shutdown_priv:y
Process_priv:y
File_priv:y
Grant_priv:y
References_priv:y
Index_priv:y
Alter_priv:y
Show_db_priv:y
Super_priv:y
Create_tmp_table_priv:y
Lock_tables_priv:y
Execute_priv:y
Repl_slave_priv:y
Repl_client_priv:y
Create_view_priv:y
Show_view_priv:y
Create_routine_priv:y
Alter_routine_priv:y
Create_user_priv:y
Event_priv:y
Trigger_priv:y
Ssl_type:
Ssl_cipher:
X509_issuer:
X509_subject:
max_questions:0
max_updates:0
max_connections:0
max_user_connections:0
2. Row ***************************
Host:localhost.localdomain
User:root
Password:
Select_priv:y
Insert_priv:y
Update_priv:y
Delete_priv:y
Create_priv:y
Drop_priv:y
Reload_priv:y
Shutdown_priv:y
Process_priv:y
File_priv:y
Grant_priv:y
References_priv:y
Index_priv:y
Alter_priv:y
Show_db_priv:y
Super_priv:y
Create_tmp_table_priv:y
Lock_tables_priv:y
Execute_priv:y
Repl_slave_priv:y
Repl_client_priv:y
Create_view_priv:y
Show_view_priv:y
Create_routine_priv:y
Alter_routine_priv:y
Create_user_priv:y
Event_priv:y
Trigger_priv:y
Ssl_type:
Ssl_cipher:
X509_issuer:
X509_subject:
max_questions:0
max_updates:0
max_connections:0
max_user_connections:0
3. Row ***************************
host:127.0.0.1
User:root
Password:
Select_priv:y
Insert_priv:y
Update_priv:y
Delete_priv:y
Create_priv:y
Drop_priv:y
Reload_priv:y
Shutdown_priv:y
Process_priv:y
File_priv:y
Grant_priv:y
References_priv:y
Index_priv:y
Alter_priv:y
Show_db_priv:y
Super_priv:y
Create_tmp_table_priv:y
Lock_tables_priv:y
Execute_priv:y
Repl_slave_priv:y
Repl_client_priv:y
Create_view_priv:y
Show_view_priv:y
Create_routine_priv:y
Alter_routine_priv:y
Create_user_priv:y
Event_priv:y
Trigger_priv:y
Ssl_type:
Ssl_cipher:
X509_issuer:
X509_subject:
max_questions:0
max_updates:0
max_connections:0
max_user_connections:0
4. Row ***************************
Host:localhost
User:
Password:
Select_priv:n
Insert_priv:n
Update_priv:n
Delete_priv:n
Create_priv:n
Drop_priv:n
Reload_priv:n
Shutdown_priv:n
Process_priv:n
File_priv:n
Grant_priv:n
References_priv:n
Index_priv:n
Alter_priv:n
Show_db_priv:n
Super_priv:n
Create_tmp_table_priv:n
Lock_tables_priv:n
Execute_priv:n
Repl_slave_priv:n
Repl_client_priv:n
Create_view_priv:n
Show_view_priv:n
Create_routine_priv:n
Alter_routine_priv:n
Create_user_priv:n
Event_priv:n
Trigger_priv:n
Ssl_type:
Ssl_cipher:
X509_issuer:
X509_subject:
max_questions:0
max_updates:0
max_connections:0
max_user_connections:0
5. Row ***************************
Host:localhost.localdomain
User:
Password:
Select_priv:n
Insert_priv:n
Update_priv:n
Delete_priv:n
Create_priv:n
Drop_priv:n
Reload_priv:n
Shutdown_priv:n
Process_priv:n
File_priv:n
Grant_priv:n
References_priv:n
Index_priv:n
Alter_priv:n
Show_db_priv:n
Super_priv:n
Create_tmp_table_priv:n
Lock_tables_priv:n
Execute_priv:n
Repl_slave_priv:n
Repl_client_priv:n
Create_view_priv:n
Show_view_priv:n
Create_routine_priv:n
Alter_routine_priv:n
Create_user_priv:n
Event_priv:n
Trigger_priv:n
Ssl_type:
Ssl_cipher:
X509_issuer:
X509_subject:
max_questions:0
max_updates:0
max_connections:0
max_user_connections:0
6. Row ***************************
Host:%
User:cacti
Password: *698756c099abd932c2f76c4a69c24608e8460b75
Select_priv:n
Insert_priv:n
Update_priv:n
Delete_priv:n
Create_priv:n
Drop_priv:n
Reload_priv:n
Shutdown_priv:n
Process_priv:n
File_priv:n
Grant_priv:n
References_priv:n
Index_priv:n
Alter_priv:n
Show_db_priv:n
Super_priv:n
Create_tmp_table_priv:n
Lock_tables_priv:n
Execute_priv:n
Repl_slave_priv:n
Repl_client_priv:n
Create_view_priv:n
Show_view_priv:n
Create_routine_priv:n
Alter_routine_priv:n
Create_user_priv:n
Event_priv:n
Trigger_priv:n
Ssl_type:
Ssl_cipher:
X509_issuer:
X509_subject:
max_questions:0
max_updates:0
max_connections:0
max_user_connections:0
6 rows in Set (0.00 sec)

ERROR:
No query specified




MySQL 5.1 because the user with host localhost is empty and the password is empty, the local user cannot log on.

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.