{"rsdb":{"rid":"301770","subhead":"","postdate":"0","aid":"217018","fid":"57","uid":"1","topic":"1","content":"

mysql_config_editor<\/strong><\/p>

\u5e2e\u52a9\u4fe1\u606f\u8bf7\u67e5\u770b<\/p>

man mysql_config_editor \u6216 mysql_config_editor -? \u6216 mysql_config_editor set -?<\/p>

\u8be5\u5de5\u5177\u4f1a\u5728\u7528\u6237\u5bb6\u76ee\u5f55\u751f\u6210\u4e8c\u8fdb\u5236\u6587\u4ef6\uff1a.mylogin.cnf<\/p>

\u8be5\u6587\u4ef6\u683c\u5f0f\u7531\u9009\u9879\u7ec4\u7ec4\u6210\uff0c\u6bcf\u4e2a\u9009\u9879\u7ec4\u88ab\u79f0\u4e3alogin path ,\u4ec5\u5305\u542b\u7279\u5b9a\u9009\u9879\uff1a host, user, password, port and socket \u7528\u4e8e\u7528\u6237\u9a8c\u8bc1\u3002<\/p>

\u7528\u6cd5\uff1a<\/strong><\/p>

mysql_config_editor set [command options] Sets user name\/password\/host name\/socket\/port for a given login path (section).<\/p>

mysql_config_editor remove [command options] Remove a login path from the login file.<\/p>

mysql_config_editor print [command options] Print all the options for a specified login path.<\/p>

mysql_config_editor reset [command options] Deletes the contents of the login file.<\/p>

\u8bbe\u7f6e login path<\/strong><\/p>

[root@mysql1 ~]# mysql_config_editor set -?<\/p>

-h, --host=name Host name to be entered into the login file.
 -G, --login-path=name Name of the login path to use in the login file. (Default: client)
 -p, --password Prompt for password to be entered into the login file.
 -u, --user=name User name to be entered into the login file.
 -S, --socket=name Socket path to be entered into login file.
 -P, --port=name Port number to be entered into login file.<\/p>

\u5982\uff1a<\/p>

mysql_config_editor set -G mypath -u root -p -S \/u01\/data\/mysql5.7.25\/mysql.sock<\/p>

mysql_config_editor set -G user1 -u user1 -p -S \/u01\/data\/mysql5.7.25\/mysql.sock<\/p>

\u663e\u793a login path<\/p>

mysql_config_editor print --all<\/p>

mysql_config_editor print -G user1<\/p>

[root@mysql1 ~]# mysql_config_editor print --all
[client] # \u9ed8\u8ba4 login path
[mypath]
user = root
password = *****
socket = \/u01\/data\/mysql5.7.25\/mysql.sock
[mypath1]
user = root
password = *****
socket = \/u01\/data\/mysql5.7.25\/mysql.sock
[user1]
user = user1
password = *****
socket = \/u01\/data\/mysql5.7.25\/mysql.sock<\/p>

\u5220\u9664 login path<\/strong><\/p>

mysql_config_editor remove -G user1<\/p>

[root@mysql1 ~]# mysql_config_editor remove -G user1
[root@mysql1 ~]# mysql_config_editor print --all
[client]
[mypath]
user = root
password = *****
socket = \/u01\/data\/mysql5.7.25\/mysql.sock
[mypath1]
user = root
password = *****
socket = \/u01\/data\/mysql5.7.25\/mysql.sock<\/p>

\u91cd\u7f6e login file<\/strong><\/p>

mysql_config_editor reset<\/p>


[root@mysql1 ~]# mysql_config_editor reset
[root@mysql1 ~]# mysql_config_editor print --all  # \u6587\u4ef6\u5df2\u88ab\u6e05\u7a7a<\/p>

 <\/p>

\u4f7f\u7528 login path<\/p>

mysql --login-path=mypath<\/p>

mysqladmin  --login-path=mypath<\/p>


[root@mysql1 ~]# mysqladmin --login-path=mypath status
Uptime: 11918 Threads: 1 Questions: 18 Slow queries: 0 Opens: 106 Flush tables: 1 Open tables: 99 Queries per second avg: 0.001<\/p>

 <\/p>","orderid":"0","title":"MySQL \u5b89\u5168\u767b\u9646\u5de5\u5177 mysql_config_editor","smalltitle":"","mid":"0","fname":"\u6570\u636e\u5e93\u7f16\u7a0b","special_id":"0","bak_id":"0","info":"0","hits":"108","pages":"1","comments":"0","posttime":"2019-04-02 22:08:35","list":"1554214115","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"MySQL<\/A> \u5b89\u5168<\/A> \u767b\u9646<\/A> \u5de5\u5177<\/A> mysql_config_editor<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"47.106.78.186","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"MySQL \u5b89\u5168\u767b\u9646\u5de5\u5177 mysql_config_editor","lastview":"1713344438","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}