MySQL Create Database
Create Database Using mysqladmin
You would need special privileges to create or to delete a MySQL database. So assuming you have access to the root user, you can create any database using the mysql mysqladmin binary.
Example
Here is a simple example to create a database called School −
[root@host]# mysqladmin -u root -p create SCHOOL Enter password:******
or you can do the same on mysql>prompt
mysql> create database SCHOOL
This will generate a database SCHOOL on your MySQL server.
Python Script to Create a DataBase
MySQL .connector module has been used to generate a new database. Connect() function basically accept a certain parameter to establish a connection between MySQL and Python.
Example
import mysql.connector conn = mysql.connector.connect(host='localhost',user='root',password='') cursor = conn.cursor() cursor.execute('create database SCHOOL;') conn.close() print('database created successfully')