Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL 5.1/5.5临时表行为更改_Mysql_Mariadb - Fatal编程技术网

MySQL 5.1/5.5临时表行为更改

MySQL 5.1/5.5临时表行为更改,mysql,mariadb,Mysql,Mariadb,在测试从MySQL 5.1升级到MariaDB 5.5的过程中,我遇到了以下行为变化 请注意,在这两种情况下,这都是在从属(只读)服务器上使用具有alter table权限的非root用户 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`)

在测试从MySQL 5.1升级到MariaDB 5.5的过程中,我遇到了以下行为变化

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

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 [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
MariaDB 5.5:

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 [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`));
避免了这个问题

为什么它是只读的?也许是奴隶?还是双主机、单编写器设置中的主机?我不会在不理解为什么它会打开的情况下关闭“只读”——默认情况下它不会打开


潜在的(可能导致MariaDB错误)表明,
binlog\u format=ROW
可能是一个解决方案。

这个问题相当棘手。我们发现,只有当引擎为innodb(!)时才会出现,这是MariaDB的默认类型(或者至少在Centos 7中是这样)


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

看起来您遇到了。作为一种解决方法,请通过
SET GLOBAL read\u only=0
禁用只读,或在
my.cnf
文件中对其进行更改。是的,它是只读的,因为它是从机。我们发现根本的问题在于引擎类型,因为一旦我们将默认值切换到myisam(这意味着使用该类型创建临时表),它就可以工作了。。。我认为不能在只读服务器上操作临时表是一个错误。5.7正在改进InnoDB中临时表的处理。我们可能不得不等待该版本的“真正”修复。