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.
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
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.
3. If you’ve created a database name, try creating a user which will be associated with database name on the same page.
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.
5. Don’t forget to give all privileges to the database user.
Congratulations, you’ve created a database connection in MySql.