<?php
$server="localhost";
$user="root";
$password="";
$database="school";
$conn=mysqli_connect($server, $user, $password, $database);
if($conn){
echo "Server connected with database successfully.";
}
else{
echo "Failed, unable to connect with database.";
}
?>
Where localhost is server name it can be either localhost or 127.0.0.1 or sometime with port value like 127.0.0.1:8080
root is default user name
By default password is empty for default root user.
school is database name
mysqli_connect
This function is used to connect with database.
$conn
it is a connection variable and used to execute query on server.