MySQL 5.1 / MariaDB 5.5 临时 table 行为更改

MySQL 5.1 / MariaDB 5.5 temporary table behavior change

在测试从 MySQL 5.1 到 MariaDB 5.5 的升级时,我 运行 进行了以下行为更改。

请注意,在这两种情况下,这都是在从属(只读)服务器上使用具有更改 table 权限的非根用户。

MySQl 5.1:

mysql> create temporary table testtest (id int);
Query OK, 0 rows affected (0.00 sec)

mysql> ALTER TABLE `testtest` ADD PRIMARY KEY(`id`);
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB 5.5:

MariaDB [pollstream_common]> create temporary table testtest (id int);
Query OK, 0 rows affected (0.20 sec)

MariaDB [pollstream_common]> ALTER TABLE `testtest` ADD PRIMARY KEY(`id`);
ERROR 1290 (HY000): The MariaDB server is running with the --read-only option so it cannot execute this statement

有谁知道这种行为变化是有意为之,还是有解决方法?因为更改和测试使用以前版本实现并且已经工作了一段时间的现有代码将是一项相当大的工作。

提前致谢!

create temporary table testtest (id int, PRIMARY KEY(`id`));

避免问题。

为什么是 read_only?也许它是一个奴隶?还是双主机、单写入器设置中的主机?我不会关闭 read_only 不明白为什么它是打开的——默认情况下它没有打开。

底层 MySQL bug(可能导致 MariaDB 错误)表明 binlog_format = ROW 可能是一个解决方案。

问题比较棘手。我们发现,如果引擎是 innodb (!),它 只有 出现,这是 MariaDB 的默认类型(或者至少在 Centos 7 中是这样)。

一旦我们在 my.cnf 中设置了 default-storage-engine=myisam,问题就消失了。我怀疑这是一个错误而不是预期的行为,但这是它的修复方式。