Python Tutorials · Python MySQL
MySQL Create Database
Learn all about MySQL Create Database in this comprehensive tutorial.
5 min read advanced
- •To create a database in MySQL, use the "CREATE DATABASE" statement:
- •You can check if a database exist by listing all databases in your system by using the "SHOW DATABASES" statement:
Creating a Database
To create a database in MySQL, use the "CREATE DATABASE" statement:
python
If the above code was executed with no errors, you have successfully created a database.
Check if Database Exists
You can check if a database exist by listing all databases in your system by using the "SHOW DATABASES" statement:
python
Or you can try to access the database when making the connection:
python
If the database does not exist, you will get an error.
Module quiz
Test your knowledge on this module
5 questions