summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/optimize_mythdb.py
blob: 8139f6390a4acc60b378129f22e4950c835294c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python2
# 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)