blob: 7d60e89f4fe47564448a0877b6bee66990f0035d (
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)
|