First, you’ll need the mysql.connector
. In case you are not sure of how you can get this setup, consult with The right way to Set up MySQL Driver in Python.
The right way to Delete/Drop a MySQL Desk in Python
import mysql.connector
mydb = mysql.connector.join(
host = "localhost",
person = "username",
password = "YoUrPaSsWoRd",
database = "your_database"
)
mycursor = mydb.cursor()
sql = "DROP TABLE prospects"
mycursor.execute(sql)
The right way to Delete/Drop Provided that MySQL Desk Exists in Python
import mysql.connector
mydb = mysql.connector.join(
host = "localhost",
person = "username",
password = "YoUrPaSsWoRd",
database = "your_database"
)
mycursor = mydb.cursor()
sql = "DROP TABLE IF EXISTS prospects"
mycursor.execute(sql)