py3.5查询mysql的问题,python3使用pymysql连接mysql数据库报Keyerror

在尝试使用pymysql库连接到MySQL数据库时遇到了错误。具体表现为在初始化连接时,因无法找到对应的字符集ID(224)而导致KeyError。这可能是由于数据库配置、字符集设置或pymysql版本不兼容问题引起的。
摘要由CSDN通过智能技术生成

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

不好意思

Traceback (most recent call last):

File "d:\Python\practice2\mydbconn.py", line 5, in

conn = pymysql.connect(user='testuser', passwd='testpasswd',host='192.168.1.3', db='test',charset='utf8')

File "C:\Users\testuser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymysql3-0.5-py3.5.egg\pymysql\__init__.py", line 93, in Connect

File "C:\Users\testuser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymysql3-0.5-py3.5.egg\pymysql\connections.py", line 510, in __init__

File "C:\Users\testuser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymysql3-0.5-py3.5.egg\pymysql\connections.py", line 676, in _connect

File "C:\Users\testuser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymysql3-0.5-py3.5.egg\pymysql\connections.py", line 830, in _get_server_information

File "C:\Users\testuser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymysql3-0.5-py3.5.egg\pymysql\charset.py", line 173, in charset_by_id

File "C:\Users\testuser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pymysql3-0.5-py3.5.egg\pymysql\charset.py", line 21, in by_id

KeyError: 224

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值