How to Connect php with mysql Database

Code for mysql connection with php

1. In the below  we can deifne our host name. For local you can use localhost. If you want to acces the other host then put that host  name or Server IP here
2.This code for db user name. For local we use root. But you can create  db user name whatever you want.
3. Here we can define db password. For local you should leave blank.
4.Here we define our  database name
5. The mysqli_connect() function opens a new connection to the MySQL server.

Anuj Kumar

I'm Anuj kumar a web developer with 4+ year experience .I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.

Recommended Tutorials for you

You may also like...

Leave a Reply

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