Home php How to Make Database Connection in PHP with MySql

How to Make Database Connection in PHP with MySql

php database connection string for mysql

This is very important post for PHP learner/beginner. Today I will tell you about how to make connection  PHP with Database using Mysql Query.

How to make connection php with database

Php provides connection string function to make connection in between database and PHP.

Please check it out connection string as given below :-

Here we will pass Three connection parameters

Hostname, username and password we have to put it or pass in parameters

Parameters are given as below(Also know as connection parameter):

Hostname :localhost

Username :root

Password : Enter password if available/leave blank

In case of live hosting we can changes these parameter according to live  MySQL  username and password its up to you what you have created your MySql username and password.

We can  show example according to local envoirment  as well as live.

First step: set connection parameter value and establish connection string

For local Environment:

For Live Environment:


Please enter your comment!
Please enter your name here