PHP MySQL Connect
Connecting to the MySQL server
Note that this page uses the mysqli functions and not the old mysql functions.PHP has the function mysqli_connect to connect to a MySQL server which handles all of the low level socket handling. We will supply 4 arguments; the first is the name of your MySQL server, the second a MySQL username, third a MySQL password and last a database name. In this example, it is assumed your server is localhost. If you are running a web server on one system, and MySQL on another system, you can replace localhost with the IP address or domain name of the system which MySQL resides on (ensure all firewalls are configured to open the appropriate ports). mysqli_connect returns a link_identifier that we can now use for communicating with the database. We will store this link in a variable called $link.
<?php
$link = mysqli_connect ("localhost", "your_user_name", "your_password", "database_name");
?>


