mysql_config_editor介绍
mysql_config_editor是MySQL自带的一款用于安全加密登录的工具,可以在一些场合避免使用密码明文,例如,写shell脚本时,不用在为在脚本里面写入明文密码纠结了;也可以用于管理多台MySQL实例。另外,像如果使用mysql命令登录数据库,可以避免每次都要输入一堆参数。简单方便。
官方文档介绍如下:
The mysql_config_editor utility enables you to store authentication credentials in an obfuscated login path file named .mylogin.cnf. The file location is the %APPDATA%\MySQL directory on Windows and the current user's home directory on non-Windows systems. The file can be read later by MySQL client programs to obtain authentication credentials for connecting to MySQL Server.
mysql_config_editor使用
帮助信息查看
# mysql_config_editor --help
mysql_config_editor Ver 1.0 Distrib 5.7.30, for Linux on x86_64
Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
MySQL Configuration Utility.
Usage: mysql_config_editor [program options] [command [command options]]
-#, --debug[=#] This is a non-debug version. Catch this and exit.
-?, --help Display this help and exit.
-v, --verbose Write more information.
-V, --version Output version information and exit.
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- ----------------------------------------
verbose FALSE
Where command can be any one of the following :
set [command options] Sets user name/password/host name/socket/port
for a given login path (section).
remove [command options] Remove a login path from the login file.
print [command options] Print all the options for a specified
login path.
reset [command options] Deletes the contents of the login file.
help Display this usage/help information.