Warning: Using a password on the command line interface can be insecure.解决办法

被一个小朋友问到,直接公布答案:

If your MySQL client/server version is a 5.6.x a way to avoid the WARNING message are using the mysql_config_editor tools:

mysql_config_editor set --login-path=local --host=localhost --user=username --password

Then you can use in your shell script:

mysql --login-path=local -e "statement"

instead of:

mysql -u username -p pass -e "statement"

posted @ 2017-01-06 16:10  sunss  阅读(13340)  评论(0编辑  收藏  举报