How do I change the data type for a column in MySQL?

Eric Wilson picture Eric Wilson · Aug 31, 2009 · Viewed 666.1k times · Source

I want to change the data type of multiple columns from float to int. What is the simplest way to do this?

There is no data to worry about, yet.

Answer

Yannick Motton picture Yannick Motton · Aug 31, 2009

http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

ALTER TABLE tablename MODIFY columnname INTEGER;

This will change the datatype of given column

Depending on how many columns you wish to modify it might be best to generate a script, or use some kind of mysql client GUI