---
title: "Python MySQL Create Database"  
description: "Python MySQL Create Database"  
author: "Anonymous User"  
published: 2018-07-09  
updated: 2018-07-09  
canonical: https://www.mindstick.com/forum/34594/python-mysql-create-database  
category: "python"  
tags: ["python-3.4", "python"]  
reading_time: 1 minute  

---

# Python MySQL Create Database

How to [Create Database](https://www.mindstick.com/articles/1623/sfdc-create-an-app-and-database) [MySQL](https://www.mindstick.com/articles/12156/what-is-mysql) in [Python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python) ?

## Replies

### Reply by Prakash nidhi Verma

Python needs a MySQL driver to access the MySQL [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax).

In this tutorial we will use the driver "MySQL Connector".

We recommend that you use PIP to install "MySQL Connector installation of mysql connector :

```
C:\Users\Your Name\AppData\Local\Programs\Python\Python36-32\Scripts>python -m pip install mysql-connector 
```

DataBase connector import in system :

```
import mysql.connector 
```

example :

```
mydb = mysql.connector.connect(   host="localhost",
  user="yourusername",
  passwd="yourpassword"
)
mycursor = mydb.cursor()

mycursor.execute("CREATE DATABASE mydatabase")
```


---

Original Source: https://www.mindstick.com/forum/34594/python-mysql-create-database

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
