obclient连接集群报错unknown variable aracter-set=utf8

【产品名称】OceanBase

【产品版本】

CentOS 7.6; OceanBase Deployer 1.1.0; OceanBase 3.1.0CEBP2; obproxy-3.1.0-1.el7; OBClient 2.0.0-2。

【问题描述】

1.obclient通过obproxy登录observer报错:obclient: unknown variable ‘aracter-set=utf8’

[admin@obp1 ~]$ obclient -h192.168.80.25 -P2883 -uroot@tenant1#obcluster oceanbase -c -A -p’ob+pwd’ obclient: unknown variable ‘aracter-set=utf8’ [admin@obp1 ~]$ obclient -h192.168.80.25 -P2883 -uroot@sys#obcluster oceanbase -c -A -p’ob+pwd’ obclient: unknown variable ‘aracter-set=utf8’

2.使用odc、sql developer连接均正常

3.查看sys、tenant1租户变量未发现异常

补充:

您好,这个问题错误的原因是通过obclient端向数据库发送了 "set aracter-set=utf8" 这样的指令,然后报的无法识别aracter-set这样的参数错误。

经确认,obclient内部不会主动发送这样的指令,推测是obclient的机器有/etc/my.cnf等类似这样的配置文件,里面[client]配置中存在aracter-set=utf8 这样不合法的参数信息,可以在本机器中检查一下。

经排查,obproxy主机上有同事安装了mariadb.后卸载mariadb、mariadb-server,但保留了mariadb-libs-5.5.68.1

[admin@obp1 ~]$ mysql      #之前未安装mysql客户端
mysql: unknown variable 'aracter-set=utf8'
[root@obp1 ~]# rpm -qa | grep mariadb
mariadb-5.5.68-1.el7.x86_64
mariadb-server-5.5.68-1.el7.x86_64
mariadb-libs-5.5.68-1.el7.x86_64
[root@obp1 ~]# rpm -e mariadb-server-5.5.68-1.el7.x86_64
warning: /var/log/mariadb/mariadb.log saved as /var/log/mariadb/mariadb.log.rpmsave
You have new mail in /var/spool/mail/root
[root@obp1 ~]# rpm -qa | grep mariadb
mariadb-5.5.68-1.el7.x86_64
mariadb-libs-5.5.68-1.el7.x86_64
[root@obp1 ~]# rpm -e mariadb-5.5.68-1.el7.x86_64
warning: /etc/my.cnf.d/client.cnf saved as /etc/my.cnf.d/client.cnf.rpmsave
[root@obp1 ~]# ls /etc/my.cnf
/etc/my.cnf
[root@obp1 ~]# view /etc/my.cnf
[root@obp1 ~]# mysql
-bash: /usr/bin/mysql: No such file or directory


my.cnf配置如下:

[admin@obp1 ~]$ cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
Settings user and group are ignored when systemd is used.
If you need to run mysqld under a different user or group,
customize your systemd unit file for mariadb according to the
instructions in http://fedoraproject.org/wiki/Systemd
initconnect='SET collationconnection = utf8unicodeci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8unicodeci
skip-character-set-client-handshake
maxallowedpacket=1024M

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

include all files from the config directory
!includedir /etc/my.cnf.d


仍旧连接报错:

[admin@obp1 ~]$ obclient -h192.168.80.25 -P2883 -uroot@sys#obcluster oceanbase -c -A -p'ob+pwd'
obclient: unknown variable 'aracter-set=utf8'


请近一步指正。

obproxy主机my.cnf配置截图:

问题已解决:

1) 将当前obclient异常主机的client.cnf.rpmsave文件改名;

2)将当前obclient异常主机的mysql-clients.cnf文件中这行“aracter-set=utf8”删除

[root@obp1 etc]# mv /etc/my.cnf.d/client.cnf.rpmsave /etc/my.cnf.d/client.cnf.rpmsave.orig
[root@obp1 etc]# cd my.cnf.d/
[root@obp1 my.cnf.d]# ls
client.cnf.rpmsave.orig mysql-clients.cnf
[root@obp1 my.cnf.d]# cp mysql-clients.cnf mysql-clients.cnf.orig
[root@obp1 my.cnf.d]# cat mysql-clients.cnf
These groups are read by MariaDB command-line tools
Use it for options that affect only one utility

[mysql]
aracter-set=utf8
[mysql_upgrade]

[mysqladmin]

[mysqlbinlog]

[mysqlcheck]

[mysqldump]

[mysqlimport]

[mysqlshow]

[mysqlslap]

3) 再次连接正常

[admin@obp1 ~]$ obclient -h192.168.80.25 -P2883 -uroot@tenant1#obcluster oceanbase -c -A -p'ob+pwd'
Welcome to the OceanBase. Commands end with ; or \g.
Your MySQL connection id is 3221492501
Server version: 5.7.25 OceanBase 3.1.0 (r3-b20901e8c84d3ea774beeaca963c67d7802e4b4e) (Built Aug 10 2021 07:51:04)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [oceanbase]> 

感谢致云老师!