How to connect mysql in PHP5.5
Mysql connection in php
Connect to mysql database using php with following code. Mysql database connect in php is very easy, just use this code. Replace the demo username and password with correct ones.
$hostname = "localhost or hostname"; $myusername = "mysql username"; $password = "mysql password"; // Create connection $connection = new mysqli($hostname, $myusername, $password); // Check connection if ($connection->connect_error) { die("Connection failed: " . $connection->connect_error); } echo "Connected successfully";