python MySQLdb 在 linux上使用的一些问题
1.select error: (2014, "Commands out of sync; you can't run this command now")
为什么会报这个错误呢?是因为我先执行了一个insert接着就执行select,而且在insert的sql语句中使用了commit;
这个就是出错的根源。
只要去掉insert的sql语句中的commit;并将commit;换到select的sql语句中就好了
即可,原理请见:http://blog.xupeng.me/2012/03/13/mysql-python-commands-out-of-sync/

浙公网安备 33010602011771号