Question

I currently have a mysql table which is reaching the maxint mark with the autoincrement column.

Is it save to change the field type to Bigint without loss of data?

Or do I need to use a duplicate table with a bigint field, copy all data, and then remove the original and rename the copy to be sure I don't lose data?

Était-ce utile?

La solution

BIGINT can hold all INT values so type conversion is possible without any loss of data.

ALTER TABLE <tbl> CHANGE <col> <col> BIGINT;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top