(Linux)- mysql_secure_installation 安全安裝

(Linux)- mysql_secure_installation 安全安裝

(Linux)- mysql_secure_installation 安全安裝

主要介紹 MySQL ( Mariadb )  安全配置嚮導 mysql_secure_installation 各項配置的含義,需要的可以參考下。

1. mysql_secure_installation 設定

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

1. 為 root 使用者設置密碼
2. 刪除匿名帳號
3. 取消 root 用戶遠端登入
4. 刪除 test 庫和對 test 庫的存取權限
5. 刷新授權表使修改生效

通過這幾項的設置能夠提高 mysql 庫的安全。建議生產環境中 mysql 安裝這完成後一定要運行一次mysql_secure_installation。

2. 詳細設定步驟:

[root@server1 ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): <–初次運行直接 Enter
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] <– 是否設置 root 使用者密碼,輸入 y 並 Enter 或直接 Enter
New password: <– 設置 root 使用者的密碼
Re-enter new password: <– 再輸入一次你設置的密碼
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <– 是否刪除匿名使用者,生產環境建議刪除,所以直接 Enter
… Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <– 是否禁止 root 遠端登入,根據自己的需求選擇 Y/n 並 Enter,建議禁止
… Success!

By default, MySQL comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <– 是否刪除 test 資料庫,直接 Enter
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <– 是否重新載入許可權限表,直接回車
… Success!

 

Cleaning up…

All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
[root@server1 ~]#

PS:如果是安裝 Mariadb ,上述 MySQL 會顯示 Mariadb。

免責聲明:

1.本影像檔案皆從網上搜集轉載,不承擔任何技術及版權問題。

2.如有下載連結僅供寬頻測試研究用途,請下載後在24小時內刪除,請勿用於商業。

3.若侵犯了您的合法權益,請來信通知我們,我們會及時刪除,給您帶來的不便,深表歉意。



發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *