There are four basic steps that are used to create a new MySQL database in PHP. They are as follows:
First, a connection is established to the MySQL server using the PHP script.
Second, the connection is validated. If the connection is successful, then you can write a sample query to verify.
Queries that create the database are input and later stored into a string variable.
Then, the created queries are executed one after the other.