Connect to MySQL Database using PHP

The following script tries to connect the database and if it is failed it will display relevant message. The server is localhost and username/password combination is root/abc123. it is necessary to create a database ‘dummy’ before executing the script. Click here to set password for mysql and phpmyadmin


$con=mysql_connect(”localhost”,”root”,”abc123″) or die(”Couldnt Connect to database”);



echo “Database Selection Success”;


echo “Database Selection Failed”;



Popular Posts