zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    bzoj 4548 小奇的糖果
    CF1151F Sonya and Informatics
    loj 2392「JOISC 2017 Day 1」烟花棒
    loj 2336「JOI 2017 Final」绳
    luogu P3620 [APIO/CTSC 2007]数据备份
    bzoj 4771 七彩树
    CF765F Souvenirs
    bzoj 3145 [Feyat cup 1.5]Str
    luogu P4482 [BJWC2018]Border 的四种求法
    第五章例题
  • 原文地址:https://www.cnblogs.com/automng/p/7992526.html
Copyright © 2011-2022 走看看