300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > binlog数据库不写入binlog_mysql在不开启binlog的情况下导出数据库

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

时间:2023-07-11 15:52:25

相关推荐

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

问题背景

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

mysqldump -h172.20.17.95 -uroot -pReapal@ --set-gtid-purged=OFF --lock-tables --add-drop-table -E --flush-logs --triggers --routines --events --master-data=2 testdb > test_1206.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@ --set-gtid-purged=OFF --single-transaction --add-drop-table --triggers --routines --events -B testdb> testdb_1206.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.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。