Пробую записать переменную:
import MySQLdb znachenie = "12345" MyDB=MySQLdb.connect(host='localhost', user='mydb', passwd='pass', db='mydb', charset='utf8') cursor = MyDB.cursor() cursor.execute(""" INSERT INTO mydb(mydb) VALUES (%s)""", (znachenie)) MyDB.commit() MyDB.close()
SHOW COLUMNS FROM [mydb]; ERROR 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 '[mydb]' at line 1 mysql> SELECT * FROM [mydb]; ERROR 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 '[mydb]' at line 1