可以使用mysql自己帶的config edit

來源:互聯網
上載者:User

標籤:edit   path   自己   使用者名稱   editor   user   conf   href   use   

正常情況下,一般資料庫密碼可以寫在使用者主目錄的.my.cnf 然後設定chmod 600,一般來說是比較安全的。

但是如果不想給人知道使用者名稱和實際的密碼,但是又想給人用,可以使用mysql自己帶的config edit。

mysql_config_editorset --user=root --password

這個時候,使用者主目錄下會出現一個加密了以後的.mylogin.cnf,許可權600

直接查看會發現密碼是加密的,調用:

mysql_config_editorprint --all

可以看見摘要

直接調用mysql 就可以免密碼登入mysql_config_editor設定的預設伺服器

如果需要(2881064151)設定多個伺服器,可以使用 --login-path 參數

mysql_config_editorset --login-path=dev-slave --user=root --password --host=ip-of-server --port=3308

連結的時候,使用

mysql --login-path=dev-mysql

這種方法說不上有多安全,主要是加密以後,肉眼看不見了而已。

記得,.my.cnf 和.mylogin.cnf 一定要chmod 600

可以使用mysql自己帶的config edit

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.