MySQL: changing ROW FORMAT to DYNAMIC or COMPRESSED

If you've changed your database properties to use innodb_large_prefix = 1 and innodb_file_format = Barracuda in my.cnf as below:

you may want to convert all your existing tables to use DYNAMIC or COMPRESSED ROW_FORMAT.

For a single table, you need to run the following:


To convert all tables in a given database, here is a short bash script to do it:

The script assumes you can use mysql without specifying a password (i.e. password added to .my.cnf).