python操作mysql

import MySQLdb


conn = MySQLdb.Connection(ip, username, password, database, port)
conn.set_character_set("utf8");
cur = conn.cursor()
cur.execute("select * from table")
for data in cur.fetchall():
    ......

你可能感兴趣的:(mysql,python,table,database,import,character)