MYSQL刪除匿名用戶的辦法(進步平安性)。本站提示廣大學習愛好者:(MYSQL刪除匿名用戶的辦法(進步平安性))文章只能為提供參考,不一定能成為您想要的結果。以下是MYSQL刪除匿名用戶的辦法(進步平安性)正文
起首停滯mysql辦事:
root@webserver:/home/webmaster# service mysql stop
接著采取疏忽暗碼認證形式從新創立一個mysql辦事:
root@webserver:/home/webmaster# mysqld --user=mysql --skip-grant-tables --skip-networking &
勝利啟動後前往PID及其它啟動信息
[1] 3591
root@webserver:/home/webmaster# 121005 2:59:27 [Note] Plugin 'FEDERATED' is disabled.
121005 2:59:27 InnoDB: The InnoDB memory heap is disabled
121005 2:59:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121005 2:59:27 InnoDB: Compressed tables use zlib 1.2.3.4
121005 2:59:27 InnoDB: Initializing buffer pool, size = 128.0M
121005 2:59:27 InnoDB: Completed initialization of buffer pool
121005 2:59:27 InnoDB: highest supported file format is Barracuda.
121005 2:59:27 InnoDB: Waiting for the background threads to start
121005 2:59:28 InnoDB: 1.1.8 started; log sequence number 1595685
121005 2:59:28 [Note] mysqld: ready for connections.
Version: '5.5.24-0ubuntu0.12.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 0 (Ubuntu)
銜接到mysql體系庫:
root@webserver:/home/webmaster# mysql -u root mysql
銜接到mysql庫後直接修正root帳號的暗碼為新的暗碼'mynewpasswd':
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> update user set Password=PASSWORD('mynewpasswd') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> FLUSH PRIVILEGES;
mysql> quit;
Bye
中斷mysql辦事過程(PID 3591見後面啟動辦事時的屏幕信息):
root@webserver:/home/webmaster# kill 3591
正常啟動 mysql辦事,並用新暗碼登錄mysql辦事器勝利:
root@webserver:/home/webmaster#service mysql start
root@webserver:/home/webmaster#mysql -u root -pmynewpasswd
sec)
mysql> exit ← 加入MySQL辦事器
Bye