首页 > 代码库 > MySQL 5.7.13 的一个BUG

MySQL 5.7.13 的一个BUG

mysql今天从5.6切到5.7,在测试环境中,日志是全部打印的,发现打了一个警告:

Incorrect string value: ‘\xD6\xD0\xB9\xFA\xB1\xEA...‘ for column ‘VARIABLE_VALUE‘ at row 478

于是,谷歌之后发现答案全都是说插入数据时编码错误,然而我并没有插入数据,只是查询数据,而且网上说的那些配置修改早就修改好了。

累觉不爱,但是本着程序员精神,蛋疼了一会儿后继续谷歌,并且研究日志,发现只要执行 SHOW VARIABLES LIKE ‘XXX‘的命令就会打印一个警告。

在mysql客户端也验证了这个问题,找到了原因,于是再谷歌,发现了bug report:https://bugs.mysql.com/bug.php?id=82414

[2 Aug 16:01] Lowe Ryan
Description:
> SHOW CREATE TABLE INFORMATION_SCHEMA.GLOBAL_VARIABLES\G
*************************** 1. row ***************************
       Table: GLOBAL_VARIABLES
Create Table: CREATE TEMPORARY TABLE `GLOBAL_VARIABLES` (
  `VARIABLE_NAME` varchar(64) NOT NULL DEFAULT ‘‘,
  `VARIABLE_VALUE` varchar(1024) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

When I set log_bin as follows:

log-bin=??

It correctly sets the files on disk:

-rw-rw----   1 rlowe  1278   174B Aug  2 08:34 ??.000001
-rw-rw----   1 rlowe  1278   174B Aug  2 08:40 ??.000002
-rw-rw----   1 rlowe  1278   151B Aug  2 08:53 ??.000003
-rw-rw----   1 rlowe  1278    42B Aug  2 08:53 ??.index

But I cannot accurately retrieve log_bin_basename:

> SHOW GLOBAL VARIABLES LIKE log_bin_basename;
+------------------+-----------------------------------------------------------+
| Variable_name    | Value                                                     |
+------------------+-----------------------------------------------------------+
| log_bin_basename | /Users/rlowe/sandboxes/rsandbox_mysql-5_6_23/master/data/ |
+------------------+-----------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

> SHOW WARNINGS;
+---------+------+---------------------------------------------------------------------------------+
| Level   | Code | Message                                                                         |
+---------+------+---------------------------------------------------------------------------------+
| Warning | 1366 | Incorrect string value: \xF0\x9F\x92\xA9 for column VARIABLE_VALUE at row 1 |
+---------+------+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)

How to repeat:
Follow the steps above

Suggested fix:
Disallow utf8mb4 characters when setting log_bin OR change the character set of GLOBAL_VARIABLES
[2 Aug 16:20] Umesh Umesh
Hello Lowe Ryan,

Thank you for the report.

Thanks,
Umesh

 

此致,敬礼

 

虽然没有什么用,但一种爽的感觉悠然而生,我想这就是程序员精神。

MySQL 5.7.13 的一个BUG