MySQLdb windows create database
Question: I am trying to create a `MySQL database` in `python`.

I am using `MySQL db`.

Currently, here is what I do:

    
    
    import MySQLdb    
    db1 = MS.connect(host="localhost",user="root",passwd="****")
    

Everywhere I go it seems that everybody assumes that you know how to create a
database, but I do not. As you could guess when I run the above code I get an
error, and I assume it is because I have not created a database.

How do I create a database?


Answer: You can use SQL on the commandline/terminal:

    
    
    $ echo 'CREATE DATABASE <dbname>;' | mysql -u <username> -p
    

where

  * `<dbname>` : Name for New Database,
  * `<username>` : is your mysql username. 

Also you need to type your mysql `<password>` when prompted.

OR:

you can also use: `mysql -u <username> -p -e "create database <dbname>";`

