手记

python 拉取mysql 慢日志

#!/usr/bin/env python
#import mysql.connector
import MySQLdb
import os

os.chdir('/usr/local/mysql')

conn=MySQLdb.connect(host='127.0.0.1',user='root',passwd='123456',db='mysql')#use_unicode=True)
#conn=MySQLdb.connect("localhost","zabbix","zabbix","zabbix")

cursor=conn.cursor()

cursor.execute('select * from slow_log')

data = cursor.fetchone()

#conn.commit()
#print "zabbix users is %s " % data

cursor.close()

print data

0人推荐
随时随地看视频
慕课网APP