mysqlbinlog:未知变量'default-character-set = utf8mb4'

问题描述 投票:0回答:4

启动 mysqlbinlog 时返回错误:

root@utils # mysqlbinlog --start-datetime="2021-12-05 13:13:00"
mysqlbinlog: unknown variable 'default-character-set=utf8mb4'

如何解决?

也许,它与 /etc/mysql/mariadb.conf.d/50-client.cnf 的内容有关,即:

[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
default-character-set = utf8mb4

# socket location
socket = /var/run/mysqld/mysqld.sock

# Example of client certificate usage
# ssl-cert=/etc/mysql/client-cert.pem
# ssl-key=/etc/mysql/client-key.pem
#
# Allow only TLS encrypted connections
# ssl-verify-server-cert=on

# This group is *never* read by mysql client library, though this
# /etc/mysql/mariadb.cnf.d/client.cnf file is not read by Oracle MySQL
# client anyway.
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]

服务器配置为:

Server version: 10.3.31-MariaDB-0ubuntu0.20.04.1-log Ubuntu 20.04
mysql mariadb
4个回答
5
投票

字符集服务器= utf8mb4

mysqlbinlog --no-defaults mysql-bin.000001


2
投票

另一个解决方案是在失败的选项中添加loose_前缀:

[client]
loose-default-character-set=utf8mb4

如果不支持该选项,宽松的前缀会强制命令行工具不会抛出错误。


1
投票

将 default-character-set=utf8 行移至 [mysql] 或 [mysqld] 下面 my.cnf 文件的部分。 mysqlbinlog 读取下面的变量 [客户端],但不是[mysql]。您的命令行客户端和/或浏览器 读取配置文件的 [client] 和 [mysql] 部分。

顺便说一句,mysqlbinlog 可以采用指定的字符集,如果你使用 --set-charset=charset_name (>5.0.23) 选项。

来源:https://forums.mysql.com/read.php?103,189835,192421#msg-192421


0
投票

здесь очень доходчиво 和 правильно написано https://www.ibm.com/docs/en/devops-deploy/7.1.2?topic=database-configuring-mysql-mariadb

© www.soinside.com 2019 - 2024. All rights reserved.