I am using python 3.6, and I use PyMySQL to connect mysql.
I will create several databases. I want to write a Python script to do this for easily creating and removing them.
There is an example in PyMySQL docs with a piece of code like this:
PyMySQL docs :https://pymysql.readthedocs.io/en/latest/user/examples.html
connection = pymysql.connect(host='localhost',
user='user',
password='passwd',
db='db',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor)
In the code above, the database already exists.
Now there are no databases in mysql. I want to create them via python and PyMySQL. What should I do?