Python 3.3 Mysql连接器

Python 3.3 Mysql连接器,python,Python,可能重复: 我使用python3.3,无法连接到MySQL,因为我找不到MySQL连接器的模块 如何使用python3.3连接到MySQL?有一个名为的模块,您可能会喜欢: """This pure Python MySQL client provides a DB-API to a MySQL database by talking directly to the server via the binary client/server protocol.""" import pymysql

可能重复:

我使用python3.3,无法连接到MySQL,因为我找不到MySQL连接器的模块

如何使用python3.3连接到MySQL?

有一个名为的模块,您可能会喜欢:

"""This pure Python MySQL client provides a DB-API to a MySQL database by talking directly to the server via the binary client/server protocol."""

import pymysql
conn = pymysql.connect(host='127.0.0.1', unix_socket='/tmp/mysql.sock', user='root', passwd=None, db='mysql')
cur = conn.cursor()
cur.execute("SELECT Host,User FROM user")
for response in cur:
    print(response)
cur.close()
conn.close()

据我所知,没有人将mysql的C扩展模块移植到python3,但至少有两个纯Python模块可以与python3(以及pypypy等)配合使用:


在google上快速搜索还可以找到更多的链接(以及指向这两个项目的各种指针,包括之前提出的问问题完全相同)。

这是和/或的重复。实际上没有重复:我搜索了很长时间,很难找到python3.2的连接器。不幸的是,该连接器不适用于3.3。我如何使用Windows来使用它进行连接?当我在python 3.3上使用它时,似乎出现了问题windows@User1291223,只需从connect函数参数中删除“unix_socket=…”。