mysql5.6版本在执行mysqldump自动化备份的时候,由于脚本是自动化运行,所以必须在shell中写入mysql用户的密码,但是执行之后,出现如下错误:
Warning: Using a password on the command line interface can be insecure.
原因是5.6之后密码写在命令行不安全,解决方案是将用户名密码卸载配置文件中
vi /etc/my.cnf
在my.cnf中增加如下代码
[mysqldump] host=localhost user=username password='password'
再次执行备份命令如下
mysqldump yourdatabase > database.sql