diff --git a/2006-02-09-convert-all-tables-to-innodb.html b/2006-02-09-convert-all-tables-to-innodb.html
new file mode 100644
index 0000000..12536aa
--- /dev/null
+++ b/2006-02-09-convert-all-tables-to-innodb.html
@@ -0,0 +1,8 @@
+
+
+
+
+
+
Here’s a little bit of SQL to convert all tables in the current database to the InnoDB storage engine. It’s written for MySQL 5.0, and relies on the column count of SHOW TABLE STATUS, so it might take tweaking to work on other versions.
+
+
diff --git a/files/convert_to_innodb.sql b/files/convert_to_innodb.sql
new file mode 100644
index 0000000..aaeb096
--- /dev/null
+++ b/files/convert_to_innodb.sql
@@ -0,0 +1,37 @@
+delimiter |
+
+DROP PROCEDURE IF EXISTS convert_to_innodb|
+
+CREATE PROCEDURE convert_to_innodb ()
+ BEGIN
+ DECLARE table_name BLOB;
+ DECLARE table_engine BLOB;
+ DECLARE junk BLOB;
+ DECLARE done INT DEFAULT 0;
+ DECLARE table_cur CURSOR FOR SHOW TABLE STATUS;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+
+ OPEN table_cur;
+
+each_table:
+ WHILE done = 0 DO
+ BEGIN
+ FETCH table_cur INTO table_name,table_engine,junk,junk,junk,junk,junk,junk,junk,junk,junk,junk,junk,junk,junk,junk,junk,junk;
+ IF table_engine = 'InnoDB' THEN ITERATE each_table; END IF;
+
+ SET @qtext = CONCAT('ALTER TABLE ',table_name,' ENGINE=InnoDB;');
+
+ PREPARE aquery FROM @qtext;
+
+ EXECUTE aquery;
+
+ DEALLOCATE PREPARE aquery;
+ END;
+ END WHILE;
+
+ CLOSE table_cur;
+ END|
+
+CALL convert_to_innodb()|
+
+DROP PROCEDURE convert_to_innodb|
diff --git a/index.html b/index.html
index f4a0e7c..de22ec3 100644
--- a/index.html
+++ b/index.html
@@ -40,6 +40,7 @@
2009-Sep-11: Confusing BIND with CNAMEs
2009-Feb-19: The odd case of my mugging
2009-Feb-03: 5-packet TCP connection?
+2006-Feb-09: Convert all tables to InnoDB
2006-Feb-09: PHP/PERL/Ruby exploit
2006-Feb-07: Why is my SSH X Window forwarding broken?
2006-Feb-06: Installing Debian from a USB stick
diff --git a/markdown/2006-02-09-convert-all-tables-to-innodb.md b/markdown/2006-02-09-convert-all-tables-to-innodb.md
new file mode 100644
index 0000000..4b9a233
--- /dev/null
+++ b/markdown/2006-02-09-convert-all-tables-to-innodb.md
@@ -0,0 +1,8 @@
+
+
+
+
+
+[Here](files/convert_to_innodb.sql)’s a little bit of SQL to convert all tables in the current database to the InnoDB storage engine. It’s written for MySQL 5.0, and relies on the column count of SHOW TABLE STATUS, so it might take tweaking to work on other versions.
+
+
diff --git a/markdown/index.md b/markdown/index.md
index 9a1cd25..67d11e4 100644
--- a/markdown/index.md
+++ b/markdown/index.md
@@ -39,6 +39,7 @@
1. 2009-Sep-11: [Confusing BIND with CNAMEs](2009-09-11-confusing-bind-with-cnames.html)
1. 2009-Feb-19: [The odd case of my mugging](2019-02-19-the-odd-case-of-my-mugging.html)
1. 2009-Feb-03: [5-packet TCP connection?](2009-02-03-5-packet-tcp-connection.html)
+1. 2006-Feb-09: [Convert all tables to InnoDB](2006-02-09-convert-all-tables-to-innodb.html)
1. 2006-Feb-09: [PHP/PERL/Ruby exploit](2006-02-09-php-perl-ruby-exploit.html)
1. 2006-Feb-07: [Why is my SSH X Window forwarding broken?](2006-02-07-why-is-my-ssh-x-window-forwarding-broken.html)
1. 2006-Feb-06: [Installing Debian from a USB stick](2006-02-06-installing-debian-from-a-usb-stick.html)