Wednesday, October 4, 2023
HomeWeb DesignHow to: Create a Database Connection in MySql?

How to: Create a Database Connection in MySql?

Most of times we got to create database connection (which usually include Database Name, Username and Password) to install web scripts like WordPress, Forums, etc. It’s not much hard to create a database connection in MySql. Database connection needed when an operation is performed at a time and suppose that if a request for the data is made (a SQL Select statement) first sent that request to the database and a set is returned over a webpage.

database connection in MySql

Creating a Database Connection in MySql

In order to create a database connection, we have create database name, username and password via MySql. Follow the steps below to create one:

1. Login in to cPanel > Databases

Mysql Databases

2. On the top of the page you’ll see, Create New Database section where you have to input the database name in which the data will be saved like your posts, comments, pages, and etc.

Creating a Database from databases in Cpanel

3. If you’ve created a database name, try creating a user which will be associated with database name on the same page.

Add new user to database

4. Alright, there is only one thing left called adding the user in the database. To accomplish this task just scroll down page and you will see that “Add User to Database” section only select the user (From 3 step) and database (From 2 step) and click the button Add.

add user to the database

5. Don’t forget to give all privileges to the database user.

Grant Privileges mysql

Congratulations, you’ve created a database connection in MySql.

Muhammad Haroon
Truly yours, Muhammad Haroon is my name. Living in Karachi, Pakistan and enjoying my life playing with codes and blogging frequently, my most popular guides on Best WordPress Plugins. I founded Softstribe in 2012, when I was about to leave College. Find me on


Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular