mysql 5.6在命令行操作数据库时出现:Warning: Using a password on the command line interface can be insecure.

正常在命令操作mysql 5.6数据库时像下面这样:

mysql -uroot -p123456 -e "show slave status\G"

 会报: Warning: Using a password on the command line interface can be insecure.

如果仅仅是这样的话,我们只要不输入密码回车再输入密码就可以了,但在shell脚本中就不能这样操作

 

下面就是在脚本中的写法:

mysql --login-path=local -e "show slave status\G"

前提是在/etc/my.cnf的【mysql】里面添加了

user=root
password=123456
host=localhost

  

posted @ 2018-06-05 14:40  全爱国  阅读(458)  评论(0编辑  收藏  举报