标题: 处理mysqldump导出提示:[Warning] Using a password on the command line [打印本页] 作者: jiawang 时间: 2022-10-24 17:16 标题: 处理mysqldump导出提示:[Warning] Using a password on the command line 使用mysql备份数据库时,报[Warning] Using a password on the command line interface can be insecure.错误
[root@sztech ~]# mysqldump -uroot -pWangjia wangjia > /opt/test01.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
解决办法:
修改配置文件: vim etc/my.cnf
在最底部加入以下内容,如果加在配置文件中间,可能会报错:
user=root
password="mysql数据库的密码"
[root@sztech etc]# cat my.cnf
#[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd