执行mysqlbinlog命令报如下错误:
[root@www.cndba.cn/dave data]# mysqlbinlog --help
mysqlbinlog: unknown variable 'default-character-set=utf8'
网上搜了下有两种解决方法:
- 在/etc/my.cnf 文件的[client]中使用character-set-server代替default-character-set
- 在使用mysqlbinlog 命令时加上—no-defaults 选项
测试第一种方法时发现该参数会导致数据库无法启动:
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
#character-set-server = utf8
[root@www.cndba.cn/dave data]# service mysql start
Starting MySQL.180208 12:15:35 mysqld_safe Logging to '/mysql/log/www.cndba.cn-error.log'.
180208 12:15:35 mysqld_safe Starting mysqld daemon with databases from /mysql/data
....................................................................................................................................................................................................................................................................................................
.^C
删除后立即恢复正常:
[root@www.cndba.cn/dave log]# service mysql stop
Shutting down MySQL.. [ OK ]
[root@www.cndba.cn/dave log]# service mysql start
Starting MySQL.180208 12:34:21 mysqld_safe Logging to '/mysql/log/www.cndba.cn-error.log'.
180208 12:34:21 mysqld_safe Starting mysqld daemon with databases from /mysql/data
[ OK ]
[root@www.cndba.cn/dave log]#
所以对于这个问题,只能通过使用—no-defaults参数来解决了:
[root@www.cndba.cn/dave data]# mysqlbinlog --no-defaults --help
mysqlbinlog Ver 3.3 for redhat-linux-gnu at x86_64
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Dumps a MySQL binary log in a format usable for viewing or for piping to
the mysql command line client.
Usage: mysqlbinlog [options] log-files
-?, --help Display this help and exit.
--base64-output[=name]
Determine when the output statements should be
base64-encoded BINLOG statements: 'never' disables it and
works only for binlogs without row-based events;
'decode-rows' decodes row events into commented SQL
statements if the --verbose option is also given; 'auto'
prints base64 only when necessary (i.e., for row-based
events and format description events); 'always' prints
base64 whenever possible. 'always' is for debugging only
and should not be used in a production system. If this
argument is not given, the default is 'auto'; if it is
given with no argument, 'always' is used.
--character-sets-dir=name
版权声明:本文为博主原创文章,未经博主允许不得转载。