不說了。直接上mysql的用戶數據,第四列里面,host為localhost,用戶為空,密碼為空。
導致在本地登陸的時候除了root的賬戶外,其他賬號不需要密碼即可登陸,并且影響host為 %的用戶登陸。
這里只需要刪除對應的行即可。
mysql> delete from user where Host='localhost' and User='';
Query OK, 1 row affected (0.00 sec)
這里試過 User is NULL,貌似不支持。無法刪除。
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