Creating a MySQL Database : MySQL : Database PYTHON TUTORIALS


PYTHON TUTORIALS » Database » MySQL »

 

Creating a MySQL Database


import MySQLdb

myDB = MySQLdb.connect(host="127.0.0.1", port=3306)

cHandler = myDB.cursor()

cHandler.execute("CREATE DATABASE schedule")
cHandler.execute("USE schedule")

cHandler.execute("CREATE TABLE Arrivals (city TEXT,flight TEXT, time TEXT)")

cHandler.execute("SHOW TABLES")
results = cHandler.fetchall()
print results

cHandler.execute("DESCRIBE Arrivals")
results = cHandler.fetchall()
print results

myDB.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Database
» MySQL