Create Database in MariaDB using PyMySQL in Python
MariaDB is an open source Database Management System and its predecessor to MySQL. The pymysql client can be used to interact with MariaDB similar to that of MySQL using Python.
In this article we will look into the process of creating a database using pymysql. To create a database use the below syntax:
Syntax:CREATE DATABASE databaseName;
In this example we will be using the pymysql client to create a database named “GFG”:
The above program illustrates the creation of MariaDB database “GFG” in which host-name is ‘localhost‘, the username is ‘user’ and password is ‘your password’.
Let’s suppose we want to create a table in the database, then we need to connect to a database. Below is a program to create a table in the GFG database which was created in the above program.