1

Today I tried to reorder a column of a table using phpMyAdmin (as I have done many times before). Although the result was displayed as successful no reordering effectively happened.

It appears the problem is caused by using InnoDB as storage engine which is the default value from MySQL 5.5 onward. When I changed back to myIsam the problem was solved. It clarified why it was working on some tables.

Is this a solvable mySQL problem? Or is this regular expected behavior for InnoDB ? In the latter case phpMyAdmin should perhaps be adapted to not offer the functionality while using InnoDB.

MySQL: 5.5.29 phpMyAdmin: 4.0.4

4

1 回答 1

1

如果...重新排序列...您的意思是

 ALTER TABLE ... ORDER BY ...

然后对于具有PRIMARYUNIQUE KEY它不起作用的 InnoDB 表。这是设计使然:

ALTER TABLE
ORDER BY包含用户定义的聚集索引(PRIMARY KEY 或 NOT NULL UNIQUE 索引)的 InnoDB 表没有意义。如果存在这样的索引,InnoDB 总是根据这样的索引对表行进行排序。

另一方面,如果您没有PRIMARYUNIQUE KEY在您的表中,这是极不可能的,那么 MySQL 将允许您更改顺序。

这是演示该行为的SQLFiddle演示。

于 2013-09-24T06:37:44.353 回答