天天看點

mysql_secure_installation

安裝完mysql-server 會提示可以運作mysql_secure_installation。運作mysql_secure_installation會執行幾個設定:

  a)為root使用者設定密碼

  b)删除匿名賬号

  c)取消root使用者遠端登入

  d)删除test庫和對test庫的通路權限

  e)重新整理授權表使修改生效

1、首先來進行 MySQL 的安裝。打開超級終端,輸入:

[root@localhost ~]# yum install mysql mysql-server

2、安裝完畢,讓 MySQL 能夠随系統自動啟動:

[root@localhost ~]# chkconfig --levels 235 mysqld on

[root@localhost ~]# /etc/init.d/mysqld start

3、設定MySQL 資料 root 賬戶的密碼:

[root@localhost ~]# mysql_secure_installation

當出現如下提示時候直接按回車:

Enter current password for root

出現如下再次回車:

Set root password? [Y/n]

出現如下提示輸入你需要設定的密碼,回車後在輸入一次确認:

New password:

接下來還會有四個确認,分别是:

Remove anonymous users? [Y/n]

Disallow root login remotely? [Y/n]

Remove test database and access to it? [Y/n]

Reload privilege tables now? [Y/n]

直接回車即可。

4、重新開機mysql

/etc/init.d/mysqld restart #重新開機

繼續閱讀