標籤:style os 使用 ar strong 檔案 div sp log
mysql_config_editor出現在mysql5.6.6以後的版本,可以給指定的串連和密碼產生一個加密檔案.mylogin.cnf,預設位於目前使用者家目錄下。通過該檔案可以使用mysql、mysqladmin等直接登入,避免純文字密碼出現在指令碼中。
notice:使用該特性要求當前主機的mysql版本在5.6.6版本及以上,對將要登陸的mysql伺服器版本沒有要求。Usage:
產生加密檔案:
[[email protected] ~]# mysql_config_editor set --login-path=jjscj --host=192.168.1.190 --user=jjscj --password
Enter password:
[[email protected] ~]# ll ~/.mylogin.cnf
-rw------- 1 root root 248 Aug 28 14:58 /root/.mylogin.cnf
使用加密檔案登入:
[[email protected] ~]# mysql --login-path=jjscj
Welcome to the MySQL monitor.
查看當前主機上的加密檔案:
[[email protected] ~]# mysql_config_editor print --all
[local]
user = root
password = *****
host = localhost
[jjscj]
user = jjscj
password = *****
host = 192.168.1.190
[remote]
user = jjscj
password = *****
host = 192.168.1.190
刪除某個加密登陸:
[[email protected] ~]# mysql_config_editor remove --login-path=remote
[[email protected] ~]# mysql_config_editor print --all
[local]
user = root
password = *****
host = localhost
[jjscj]
user = jjscj
password = *****
host = 192.168.1.190
重設所有:
[[email protected] ~]# mysql_config_editor reset
MySQL-mysql_config_editor安全登入工具