mysql: [Warning] Using a password on the command line interface can be insecure
MySQL 5.6 警告信息 command line interface can be insecure
在命令行輸入密碼,就會提示這些安全警告信息。
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腳本中。
解決方法一:
對於 mysqldump 要如何避免出現(Warning: Using a password on the command line interface can be insecure.) 警告信息呢?
vim /etc/mysql/my.cnf
[mysqldump]
user=your_backup_user_name
password=your_backup_password
修改完配置文件后, 只需要執行mysqldump 腳本就可以了。備份腳本中不需要涉及用戶名密碼相關信息。
解決方法二:
在home 下,創建my.cnf文件
內容
[mysql]
host=172.17.22.124
user=your_backup_user_name
password=your_backup_password
執行方式 HOME=/home /data/opt/mysql/bin/mysql -e "show slave status\G;"| egrep "_Running|Behind_Master" >slave.log