MYSQL刪除匿名用戶的方法(提高安全性)

mysql中刪除匿名用戶詳細步驟如下:

[root@sample ~]#mysql -u root -p ← 通過密碼用root登錄
Enter password: ← 在這裏輸入密碼

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.1.20

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>select user,host from mysql.user;  ← 查看用戶信息
+------+----------------------------+
| user | host         |
+------+----------------------------+
|   | localhost       |
| root | localhost       |
|   | sample.centospub.com |
| root | sample.centospub.com  |
+------+----------------------------+
4 rows in set (0.02 sec)

mysql> delete from mysql.user where user='';  ← 刪除匿名用戶
Query OK, 2 rows affected (0.17 sec)

mysql> select user,host from mysql.user;  ← 查看用戶信息
+------+----------------------------+
| user | host         |
+------+----------------------------+
| root | localhost      |
| root | sample.centospub.com |
+------+----------------------------+
2 rows in set (0.00 sec)

mysql> exit  ← 退出MySQL服務器
Bye
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章