标题:[实践OK]Centos下_MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure. 出处:向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除 时间:Sat, 08 Dec 2018 00:07:11 +0000 作者:jackxiang 地址:http://jackxiang.com/post/9986/ 内容: Centos下_MysqL5.7(Server version: 5.7.12-log)在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure. mysql -u zabbix -p'q1w2***4' -P 3306 -h 127.0.0.1 -e "show status like 'Threads_cached';"|grep -v Value |awk '{print $2}' mysql: [Warning] Using a password on the command line interface can be insecure. 3 =========================================================================== 一)Server version: 5.7.12-log Source distribution下用 2>/dev/null并不行: mysql -u zabbix -*****' -P 3306 -h 127.0.0.1 -e "show s tatus like 'Threads_cached';"|grep -v Value |awk '{print $2}' 2>/dev/null mysql: [Warning] Using a password on the command line interface can be insecure. 二)export MYSQL_PWD=666666 也不行。 最后,用如下可行方案,如下: cat /tmp/my.cnf [client] port = 3306 socket = /tmp/mysql.sock default-character-set = utf8mb4 host = localhost user = zabbix password = 'q1w2***4' 实践成功如下: mysql --defaults-extra-file=/tmp/my.cnf -e "show status like 'Threads_cached';"|grep -v Value |awk '{print $2}' 3 =========================================================================== 以下是文章实践来源:https://www.bbsmax.com/A/nAJvbYRxJr/ 然后针对高版本Mysql备份数据库的解决方案来了,前方高能~~~ 命令和以前常用的快速导入和导入命令有所不同了,需要加载我们配置的MYSQL配置文件! /usr/local/mysql/bin/mysqldump --defaults-extra-file=/etc/my.cnf database > /data/mysql_bak/bak_test.sql //备份导出数据库 /usr/local/mysql/bin/mysql --defaults-extra-file=/etc/my.cnf database < test_db.sql //导入数据库 查看/data/mysql_bak下,发现想要的数据库备份文件出现了~ 里在提到官方Url://dev.mysql.com/doc/refman/5.6/en/password-security-user.html?spm=5176.7737807.2.3.D6p7hh Generated by Jackxiang's Bo-blog 2.1.1 Release