2018年8月27日 星期一

mysql_config_editor (讓script可以免輸入密碼)

使用方法如下
======內容======
mysql_config_editor set --login-path=mysql --host=localhost --user=username --password
======內容======

login-path:mysql登入的名稱
host:連線資料庫
user:登入使用的帳號(不要用root,建議使用專屬功能帳號,例如針對某個table)
password:資料庫密碼

查看生成帳號
======內容======
# mysql_config_editor print --all
[client]
user = username
password = *****
host = localhost
socket = /data/mysql/mysqld.sock
======內容======

設定後MySQL客戶端登陸方式:
======內容======
mysql --login-path=mysql
======內容======

沒有留言:

張貼留言