mysql -uroot -pxxx -e "show slave status\G" 会提示 Warning: Using a password on the command line interface
can be insecure.
5.6以上版本才有mysql_config_editor
创建一个login-path
mysql_config_editor set --login-path=test --user=root --password --host=localhost
Enter password:
创建好后,.mylogin.cnf将保存在用户的家目录下,该文件是不可读的,它类似于选项组,包含单个身份的验证信息
mysql --login-path=test 直接登陆
mysql --login-path=test -e "show slave status\G" 也没有错误提示
查看.mylogin.cnf里写了什么
mysql_config_editor print --all
mysql_config_editor print --login-path=test
删除.mylogin.cnf,则可以使用
mysql_config_editor remove --login-path=test