To establish the connection to MySql server, the command used is,
- mysqli_connect( );
- mysqli_close( );
Four arguments should be passed in mysqli_connect( ) to start connection, they are
- HostName : Name of your server or IP ( For local servers, 'localhost' is the host name.
- UserName : MySql user name.... Default name is 'root'
- Password : Leave blank if you didn't give password for MySql server
- DataBase Name : Database to be used.... It is optional argument.
Syntax:
mysqli_connect(hostname, username, password, db_name);
Example:
Connectivity Check:
Output:
Connected successfully
No comments:
Post a Comment