0

My MySQL table "crashed" after updating column types. I changed VARCHAR to INT and added some new columns too.

After that, when I'd like to view the table entries, every software just keeps loading and crashing... I can't even make any queries to the table. All I can do is look at the list of columns of the table. (I've tried with PhpMyAdmin, HeidiSQL and MySQL Workbench). Changes are made with HeidiSQL.

What should I do? This is the first time this happens and I've been using HeidiSQL for a long time.

4

1 回答 1

0

您已更改VARCHARINT在表架构中。乍一看我们是对的,只是更改了alter column,mysql server 照常进行,没有显示任何错误但是当您更改表时,mysql server 必须做很多工作。首先临时存储记录并重新创建模式并插入记录。如果您的表有很多记录,那么很难更改。因此,要么截断表并更改架构并重新插入,要么创建其他表并稍后重命名。

在我看来,解决方案是根据需要创建表架构。

从表中将记录插入新表中。例如-insert into new_table (col1, col2) select col1, col2 from old_table;

放下旧桌子 drop table old_table

用旧表重命名新表 rename new_table to old_table

于 2015-07-31T00:40:42.693 回答