farcepest / MySQLdb1

MySQL database connector for Python (legacy version)
https://sourceforge.net/projects/mysql-python/
667 stars 318 forks source link

Throwing "Commands out of sync; you can't run this command now" when executing multiple grant statement in MySQL 5.7 #124

Open ghost opened 7 years ago

ghost commented 7 years ago
import MySQLdb as db
cnn = db.connect()
cur = cnn.cursor()
SQL = """
grant select on *.* to test@'localhost' identified by '';
grant select on *.* to test2@'localhost' identified by '';
"""
cur.execute(SQL)
UserName011 commented 7 years ago

You have this problem apparently because both statements are executing simultaneously. https://dev.mysql.com/doc/refman/5.7/en/commands-out-of-sync.html