yum -y install holland-mysqldump.noarch
mysqldump备份简单操作:
mysqldump -h[ip] -P[端口号] -u[用户名] -p[密码] 数据库名 表名 >导出的文件名.sql
mysqldump -h[ip] -P[端口号] -u[用户名] -p[密码] 数据库名 表名1 表名2 表名3 | gzip >导出的文件名.sql.gz
出现如下错误:
Warning: Using a password on the command line interface can be insecure.
查询资料后发现:这是MySQL5.6以上版本提供的安全机制,mysql的用户名和密码不能写在脚本文件中,需要写在/etc/my.cnf中,然后:
[root@locahost ~]# vim /etc/my.cnf
在/etc/my.cnf中加入如下语句:
[client]
host=localhost
user=数据库用户
password='数据库密码'
警告没有了,问题解决了!