creating a new database with mysqldb

Heiko Wundram me at modelnine.org
Wed May 17 15:34:39 EDT 2006


Am Mittwoch 17 Mai 2006 21:23 schrieb John Salerno:
> Well, the thing about it is that all the guides I find online seem to
> begin with using a command prompt or a unix shell, neither of which will
> work in my case. I'm trying to find a way to access my database server
> using just a python script. Perhaps that isn't even possible for me to
> do without shell access. I might just have to use the msqladministrator
> in my server control panel, instead of using python.

Creating a database is just another SQL command in MySQL (which you can easily 
send to the MySQL server you're using with Python and MySQLdb):

"CREATE DATABASE <dbname>"

Of course, you need to log on with a user who is allowed to create databases.

See the MySQL documentation for more info on the available CREATE commands.

--- Heiko.



More information about the Python-list mailing list