ERROR 1833 (HY000) - Can't alter a column in MySQL

So you came across that error when trying to change the column type in a table because it's used in a foreign key constraint on another MySQL table.

Here's the way to fix it.

set foreign_key_checks=0;
ALTER TABLE tablename
  MODIFY column_name datatype;
set foreign_key_checks=1;

Basically, what we are doing here is disabling the foreign key constraint and then re-enabling it once we are done with our alteration.

Cheers!