 <p>try as follows</p> <pre><code> /*** mysqli hostname ***/ $hostname = 'localhost'; /*** mysqli username ***/ $username = 'username'; /*** mysqli password ***/ $password = 'password'; $con=mysqli_connect($hostname,$username,$password,"blog"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } </code></pre> <p>and if you want to change the selected database "blog" then only you need to write following line</p> <pre><code>mysqli_select_db($con,"replace_selected_db"); </code></pre>