MySQL 5.6 Warning: Using a password on the command line interface can be insecure

MySQL 5.6 在命令行输入密码,就会提示这些安全警告信息。

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

注: mysql -u root -pPASSWORD 或 mysqldump -u root -pPASSWORD 都会输出这样的警告信息。

1、针对 mysql

mysql -u root -pPASSWORD 改成 mysql -u root -p 再输入密码即可。

2、mysqldump 就比较麻烦了,通常都写在scripts脚本中。

vim /etc/mysql/my.cnf

[mysqldump]
user=your_backup_user_name
password=your_backup_password

修改完配置文件,重启MyQL后,只需要执行 mysqldump 脚本就可以了。备份脚本中不需要涉及用户名密码相关信息。

原文地址:https://www.cnblogs.com/52php/p/5681417.html