Skip to content

Instantly share code, notes, and snippets.

@krisys
Created April 2, 2012 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisys/2282855 to your computer and use it in GitHub Desktop.
Save krisys/2282855 to your computer and use it in GitHub Desktop.
Script to convert the DB Engine
import MySQLdb
host = ''
user = ''
passwd = ''
db = ''
# setup the connection
conn = MySQLdb.connect (host = host, user = user, passwd = passwd, db=db)
cursor = conn.cursor()
cursor.execute("SHOW TABLES")
rows = cursor.fetchall()
for row in rows:
if row is not None:
table_name = row[0]
cursor.execute("ALTER TABLE %s ENGINE=InnoDB;" % table_name )
cursor.execute("COMMIT;")
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment