What you are asking for has never been documented or attempted.
However, I have answered two posts like this in the past:
I have an additional suggestion for data you are going to delete, going forward. You will have to put some good developer effort in this one:
Before dropping a table, you should
- go to every INT and FLOAT value and make them 0
- go to every CHAR, VARCHAR and TEXT field
- get the length of the field
- update the column with the same number of bytes with all Xs or all 0s
You will have to examine the entry in INFORMATION_SCHEMA.COLUMNS for every column to determine which is numeric and which is character. Once you have manually overwritten all data in the old table, then you are free to drop it, knowing you masked the data beforehand.
CAVEAT
If all your InnoDB tables have no constraints/foreign keys, here is something you can do during some down time.
- Convert all InnoDB tables it to MyISAM
- Shutdown mysql
- delete ibdata1
- Startup MySQL
- Convert those MyISAM tables back to InnoDB
I can't take credit for that idea. Shlomi Noach suggested it back on September 19, 2013.
If the DB is not too big, here is how you can script it.
MYSQL_USER=root
MYSQL_PASS=password
MYSL_CONN="-u${MYSQL_CONN} -p${MYSQL_PASS}"
SQL="SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' ENGINE=MyISAM;')"
SQL="${SQL} FROM information_schema.tables WHERE engine='InnoDB'"
mysql ${MYSQL_CONN} -ANe"${SQL}" > Convert_To_MyISAM.sql
SQL="SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' ENGINE=InnoDB;')"
SQL="${SQL} FROM information_schema.tables WHERE engine='InnoDB'"
mysql ${MYSQL_CONN} -ANe"${SQL}" > Convert_To_InnoDB.sql
mysql ${MYSQL_CONN} -ANe"SET GLOBAL innodb_fast_shutdown = 0"
At this point, look at the two scripts in vi
or less
.
If you are satisfied with the code, then you can do this:
mysql ${MYSQL_CONN} < Convert_To_MyISAM.sql
service mysql stop
rm -f /var/lib/mysql/ibdata1
service mysql start
mysql ${MYSQL_CONN} < Convert_To_InnoDB.sql
Give it a Try !!!