Hey everybody I want to let you know that I have undertaken the grueling task of getting the heck away from WordPress. I was so sick of the problems and updates I had to do all the time. I am now using my ezbloo system and I am integrating all my old posts into the new system. It sucks, but in the end, I will save bundles of time. I needed to keep things simple and that is why I created ezbloo. I'll have more on this later for you guys after I am done with the total integration of my old posts here. So if you are looking for a post and need it faster, shoot me an email and I will make it a priority. [email protected]

In order to Create a MySql Database in PHP in MySqli you will need to have the following set up before you proceed.
  1. Hosting plan
  2. A FTP or sFTP connection in order to upload files.
  3. The login to your cPanel in order to create a database and user privileges.
Here is the code you will need to create a database in PHP. This will create a database called myDB.
// Create connection
$con= new mysqli($servername, $username, $password);
// Check connection
if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}

// Create database
$sql = "CREATE DATABASE myDB";
if ($con->query($sql) === TRUE) {
echo "Database created successfully";
} else {
echo "Error creating database: " . $con->error;
}

$con->close();

Instructions for creating a database with MySqli in PHP

For the server name use the ip address. That may save you a lot of headaches in the long run. Your username will be the username that you use to sign into your cPanel or your hosting account. you will also use the same password that you use to log into your cPanel or hosting  account. This is first time that you will use this information to create databases in your hosting accounts. You will not need this information when you are creating tables or rows in a mysql database.  You will just need the username and password for each database itself.  The next post will discuss creating user privileges in each database. You need to get this though your head now. yes you will have 2 different usernames and passwords. One to create databases and user privileges and the other usernames and passwords for each database itself.

Video Instructions

https://youtu.be/4m5jwtGabZo