W7Code » MySQL » How to Setup MySQL Database in cPanel

Today we will learn how to setup mysql database in cPanel. Increasingly in these days information is a precious commodity. As such we need a place to store this information. Whether this information is confidential or not, or even a “shopping list”.


Setup MySql Database


1. Access to your cPanel Main Page

And Select “MySQL Database Wizard

mysql panel


2. Name your Database

Name your database and click “Next Step“.

setup mysql database

3. Set UserName and Password

Choose the username and the password to your database. This is necessary to later we connect to database. And click “Create User“.

create database user

4. Set User Privileges

Now we need to setup the user privileges, this depend what you are going to do. I will check “All PRIVILEGES“. And click “Next Step“.

cpanel database

Now the database is created. Now we will connect to database using PHP.


5. Connect to Database

To connect to database we need:

  • Server Name:
    • you can find it in “General Information“, and click in “Server Information“:
    • And then search for “Server Name”server name cpanel
  • DataBase Username;
  • Database Password.


Writing our php file to connect to database:

If we want connect to our database we only need write some code:



And this is how we setup database mysql in cPanel.

Do you have any doubt? Feel free to comment bellow your doubt!



Leave a Reply