mysql> show variables like 'character_set_%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | latin1 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)
MyCAT的日志输出如下:
1. 初始化MyCAT连接池
2. 心跳检测
3. 在执行SQL语句时的连接同步。
四、当客户端字符集为utf8,服务端字符集也为utf8。
mysql> show variables like 'character_set_%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)
MyCAT的日志输出如下:
1. 初始化MyCAT连接池
2. 心跳检测
3. 在执行SQL语句时的连接同步。
总结:
初始化MyCAT连接池,心跳检测的字符与服务端字符集有关,即character_set_server设定的值。当localhost的MySQL实例的字符集改成utf8后,因为192.168.244.146和192.168.244.144两个节点的MySQL实例的字符集并没有发生变化,所以执行心跳检测时,localhost的字符集为utf8,其它两个节点仍为latin1。
同步连接与客户端字符集有关,即character_set_client设定的值。