这就是我正在尝试做的事情:
cursor.execute("CREATE DATABASE testing")
cursor.execute("USE testing")
cursor.execute("CREATE TABLE Contract(mEnd varchar(7))")
cursor.execute("CREATE TABLE User(uName varchar(15)")
当我使用 MySQLdb 运行 python 脚本时,它仅创建第一个表,并忽略所有其他代码行。
最佳答案
您的最后一条语句中缺少
)
。尽管您确实不想这样做。
关于python - 如何在python中使用MySQLdb创建多个mysql表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29066819/