binlog数据库不写入binlog_mysql在不开启binlog的情况下导出数据库

问题背景

上个DBA已经走了,一些mysql数据库连所在服务器的系统账户也没有,只有mysql 数据库的root账户和业务账户,准备导出数据迁移至新服务器,可是mysqldump命令却是必须开启binlog日志才能导出,而binlog日志的开启依赖于配置文件log-bin参数,需要登录服务器修改配置文件并重启数据库才行。

mysqldump -h172.20.17.95 -uroot -pReapal@2017 --set-gtid-purged=OFF --lock-tables --add-drop-table -E --flush-logs --triggers --routines --events --master-data=2 testdb > test_20171206.sql

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

mysqldump: Error: Binlogging on server not active

解决方案

mysql5.7之后推出了mysqlpump命令,相比mysqldump,它可以在不开启binlog的情况下备份数据,另外该命令还支持排除数据库或表进行备份

mysqlpump -h172.20.17.95 -uroot -pReapal@2017 --set-gtid-purged=OFF --single-transaction --add-drop-table --triggers --routines --events -B testdb> testdb_20171206.sql

-B, --databases Dump several databases. Note the difference in usage; in

this case no tables are given. All name arguments are

regarded as database names. 'USE db_name;' will be

included in the output.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值