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

问题

导入sql文件时,报错如下:

***@***-MacBook09  ~  mysql -uroot -proot <~/Downloads/Guns-master/guns-admin/sql/guns.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

原因

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

解决方案

针对MySQL
mysql -uroot -p <~/Downloads/Guns-master/guns-admin/sql/guns.sql

再输入密码即可。

针对MySqlDump

做如下操作:

vim /etc/mysql/my.cnf

[mysqldump]

user=your_backup_user_name

password=your_backup_password

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

猜你喜欢

转载自blog.csdn.net/u010358168/article/details/80804824