注册 登录
编程论坛 Python论坛

用pycharm连接mysql5.0数据库报错?

aljoinwang 发布于 2023-11-03 11:37, 726 次点击
pycharm2023,连接mysql5.0数据库报错
import pymysql
from pymysql.cursors import Cursor
connect = pymysql.connect(host='127.0.0.1', port=3308, user='root', passwd='123456', database='mysql', charset='utf8')
print('连接数据库成功')
cursor: Cursor = connect.cursor()
cursor.close()
connect.close()

报错信息是mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''basefile'' at line 1
请假一下这个怎么处理,谢谢!
3 回复
#2
yiyanxiyin2023-11-03 11:57
"error in your SQL syntax", sql语法错误, 检查你的sql语句包括 "basefile"的地方
#3
aljoinwang2023-11-03 14:44
好的,谢谢!
#4
是刘啊2024-05-04 17:09
高难度
1