mysql之mysql_config_editor

來源:互聯網
上載者:User

標籤:

本文來自我的github pages部落格http://galengao.github.io/ 即www.gaohuirong.cn

mysql_config_editor允許你把登入的身分識別驗證資訊儲存在一個名為.mylogin.cnf的檔案裡,該檔案的位置在windows下是在%APPDATA%\MySQL目錄下,linux下是在使用者的家目錄下。該檔案可在以後通過MySQL用戶端程式可以讀取,以獲得身分識別驗證憑據用於串連到MySQL伺服器。
mysql_config_editor允許你把登入的身分識別驗證資訊儲存在一個名為.mylogin.cnf的檔案裡,該檔案的位置在windows下是在%APPDATA%\MySQL目錄下,linux下是在使用者的家目錄下。該檔案可在以後通過MySQL用戶端程式可以讀取,以獲得身分識別驗證憑據用於串連到MySQL伺服器。
並且,該工具至少在mysql5.6.6以上的版本才可用。

建立一個login-path:
shell> mysql_config_editor set --login-path=test --user=root --password --host=localhostEnter password:

建立好後,.mylogin.cnf將儲存在使用者的家目錄下,此處我用的是RHEL6,即/home/op下。該檔案是不可讀的,它類似於選項組,包含單個身份的驗證資訊。

在登入mysql時,可以指定建立的login-path名,然後直接進入:
shell> mysql --login-path=test-loginWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.6.26-log Source distribution…………………………………………………………

但是如果有人能夠拿到該檔案,通過一些方式,是可以將其破解並擷取你的密碼。

login-path只能被建立使用者使用(OS層面)。

如果想看.mylogin.cnf裡寫了什麼,可以使用:
shell> mysql_config_editor print --all[test_login]user = rootpassword = *****[test]user = rootpassword = *****host = localhost當然想只看某一個則可寫作shell> mysql_config_editor print --login-path=test[test]user = rootpassword = *****host = localhost
若要刪除.mylogin.cnf,則可以使用
shell> mysql_config_editor remove --login-path=test

其他選項:

 

  Format   Description   Introduced  
  –all   Print all login paths      
  –debug[=debug_options]   Write a debugging log      
  –help   Display help message and exit      
  –host=host_name   Host to write to login file      
  –login-path=name   Login path name      
  –password   Solicit password to write to login file      
  –port=port_num   TCP/IP port number to write to login file 5.6.11      
  –socket=path   The Unix socket file name to write to login file 5.6.11      
  –user=user_name   User name to write to login file      
  –verbose   Verbose mode      
  –version   Display version information and exit      
  –warn   Warn and solicit confirmation for overwriting login path      

mysql之mysql_config_editor

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.