我正在尝试使用python脚本将数据插入mySql数据库。当我运行python脚本时,我收到以下错误:
Error 1064: 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 'dataBaseName' exited abnormally with signal 11: Segmentation fault: 11
')' at line 2
这是我的代码中的insert语句:
with con:
cur = con.cursor()
for mID,l,tm,s,f,p,m in zip(messageID,level,time,sender,facility,pid,message):
cur.execute("INSERT INTO LogData(ASLMessageID,Level,Time,Sender,Facility,PID,Message) VALUES('"+ mID + "','" + l + "'," + tm + ",'" + s + "','" + f +"','" + p +"','" + m + "')")
表格中的每一列有7个列表,我正在尝试简单填写表格。这适用于其他4个表格,但由于某种原因,这个表格给出了这个错误。感谢您提供任何帮助。< / p>
这是我的连接代码:
import MySQLdb as mdb
import sys
con = None
try:
con = mdb.connect('localhost', 'root', 'password', 'dataBaseName')