summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/LinHES-system/optimize_mythdb.py
blob: e7b35eddae64a85105705d34b68eee111deb7d5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python
# import MySQL module
import MySQLdb
import socket
import sys
db = MySQLdb.connect(host="localhost", user="mythtv", passwd="mythtv", db="mythconverg")
cursor = db.cursor()
cursor.execute("SHOW tables")
result = cursor.fetchall()
ops=["REPAIR","OPTIMIZE","ANALYZE"]
for row in result:
    ctable=row[0]
    for op in ops:
        print op,ctable
        cmd= "%s  table %s" %(op,ctable)
        cursor.execute(cmd)