【发布时间】:2010-12-24 14:22:46
【问题描述】:
conn = MySQLdb.connect(host='db1', user='user', passwd='pass', db='db', port=3306)
cursor = conn.cursor()
count = int(sys.argv[1])
x = 0
while x < count:
x += 1
cursor.execute("INSERT INTO auth_group(name) VALUES(%s)", (str(x)))
#if I change %s to 'kkkk', it doesn't work either.
print str(x) + ' / ' + str(count)
print 'done'
但是...如果我进入“mysql -uuser -ppass db”,它可以工作:
mysql > INSERT INTO auth_group(name) VALUES('kkkkk');
我不知道这是否是个问题……但我之前遇到了复制问题。
我想在数据库中插入 99999 行。但它是空的。
mysql> select * from auth_group;
Empty set (0.33 sec)
【问题讨论】:
-
您介意告诉我们,它到底是怎么行不通的吗?