签到成功

知道了

CNDBA社区CNDBA社区

MariaDB character-set-server 参数 导致数据库无法启动

2018-02-08 12:56 2950 0 原创 MySQL
作者: dave

执行mysqlbinlog命令报如下错误:

[root@www.cndba.cn/dave data]# mysqlbinlog --help
mysqlbinlog: unknown variable 'default-character-set=utf8'

网上搜了下有两种解决方法:http://www.cndba.cn/dave/article/2642

http://www.cndba.cn/dave/article/2642
http://www.cndba.cn/dave/article/2642
http://www.cndba.cn/dave/article/2642

  1. 在/etc/my.cnf 文件的[client]中使用character-set-server代替default-character-set
  2. 在使用mysqlbinlog 命令时加上—no-defaults 选项

测试第一种方法时发现该参数会导致数据库无法启动:http://www.cndba.cn/dave/article/2642http://www.cndba.cn/dave/article/2642http://www.cndba.cn/dave/article/2642

[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

删除后立即恢复正常:http://www.cndba.cn/dave/article/2642

[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参数来解决了:http://www.cndba.cn/dave/article/2642

http://www.cndba.cn/dave/article/2642

[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

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 2262
    原创
  • 3
    翻译
  • 579
    转载
  • 192
    评论
  • 访问:8090006次
  • 积分:4350
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ