Convert all tables to InnoDB
This commit is contained in:
8
2006-02-09-convert-all-tables-to-innodb.html
Normal file
8
2006-02-09-convert-all-tables-to-innodb.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<!--# set var="title" value="Convert all tables to InnoDB" -->
|
||||
<!--# set var="date" value="February 9, 2006" -->
|
||||
|
||||
<!--# include file="include/top.html" -->
|
||||
|
||||
<p><a href="files/convert_to_innodb.sql">Here</a>’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.</p>
|
||||
|
||||
<!--# include file="include/bottom.html" -->
|
||||
37
files/convert_to_innodb.sql
Normal file
37
files/convert_to_innodb.sql
Normal file
@@ -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|
|
||||
@@ -40,6 +40,7 @@
|
||||
<li>2009-Sep-11: <a href="2009-09-11-confusing-bind-with-cnames.html">Confusing BIND with CNAMEs</a></li>
|
||||
<li>2009-Feb-19: <a href="2019-02-19-the-odd-case-of-my-mugging.html">The odd case of my mugging</a></li>
|
||||
<li>2009-Feb-03: <a href="2009-02-03-5-packet-tcp-connection.html">5-packet TCP connection?</a></li>
|
||||
<li>2006-Feb-09: <a href="2006-02-09-convert-all-tables-to-innodb.html">Convert all tables to InnoDB</a></li>
|
||||
<li>2006-Feb-09: <a href="2006-02-09-php-perl-ruby-exploit.html">PHP/PERL/Ruby exploit</a></li>
|
||||
<li>2006-Feb-07: <a href="2006-02-07-why-is-my-ssh-x-window-forwarding-broken.html">Why is my SSH X Window forwarding broken?</a></li>
|
||||
<li>2006-Feb-06: <a href="2006-02-06-installing-debian-from-a-usb-stick.html">Installing Debian from a USB stick</a></li>
|
||||
|
||||
8
markdown/2006-02-09-convert-all-tables-to-innodb.md
Normal file
8
markdown/2006-02-09-convert-all-tables-to-innodb.md
Normal file
@@ -0,0 +1,8 @@
|
||||
<!--# set var="title" value="Convert all tables to InnoDB" -->
|
||||
<!--# set var="date" value="February 9, 2006" -->
|
||||
|
||||
<!--# include file="include/top.html" -->
|
||||
|
||||
[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.
|
||||
|
||||
<!--# include file="include/bottom.html" -->
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user