Digital Marketing

A simple python script to keep an eye on mysql process

The following codes are the same, they are just shown on different formats. Choose the one you like.

'''
@author: it.goyun.info
'''

import MySQLdb
import time

db = MySQLdb.connect(host="192.168.1.19", user="i88ca", passwd="goyun.info", db="goyun.info")
#create a cursor for the select
cur = db.cursor()

while (True):
cur.execute("show processlist;")


for row in cur.fetchall() :
# print row[0], row[1]
print row[7]
time.sleep(8);
# close the cursor
cur.close()
# close the connection
db.close ()

Comments

Popular posts from this blog

Make online money from the Internet