MySQL Forums
Forum List  »  Connector/Python

Re: Having trouble creating new database with MySQLdb
Posted by: Patrick Castle
Date: November 11, 2006 06:14AM

Argh! Worked it out!

import MySQLdb as mysql

db = mysql.connect(user="root", host="localhost", passwd="****")
c = db.cursor()

dbName = 'testDB'
cmd = "create database " + dbName + ";"

c.execute(cmd)

Just required me to think a little differently.

Regards
Patrick

Options: ReplyQuote


Subject
Written By
Posted
Re: Having trouble creating new database with MySQLdb
November 11, 2006 06:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.