python
# -*- coding:utf-8 -*-import MySQLdb#连接db = MySQLdb.connect(host="192.168.0.1", user="root", passwd='password', db="db_name", charset = "utf8")cursor = db.cursor()#执行cursor.execute("SELECT * FROM users")users = cursor.fetchall()#输出for user in users: print user[0], user[1], user[2]