How to: Create a Database Connection in MySql?

No votes yet.
Please wait...

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.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *