#!/usr/bin/env python
#encoding:utf-8
import MySQLdb
print ""
print ""
print "

book

" print "
    " connection = MySQLdb.connect(user="root", passwd="123456", db="zabbix") cursor = connection.cursor() cursor.execute("SELECT * FROM users") for row in cursor.fetchall():     print "
  • %s
  • " % row[0] print "
" print ""


[root@bogon ~]# python mysql.py


book

  • 1
  • 2
[root@bogon ~]#

yum install MySQL-python