Python MySQL Drop Database¶
- Query: drop database database_name
In [ ]:
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd=""
)
mycursor = mydb.cursor()
mycursor.execute("drop database itronix")
Python MySQL Drop Table¶
- Query: drop table table_name
In [6]:
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database="itronix"
)
mycursor = mydb.cursor()
mycursor.execute("drop table student")