I am using php5 and tried to connect it to mysql, but says server error?

<?php $password = "rinik"; $hostname = "localhost"; $database = "root"; $conn = mysql_connect($hostname, $username, $password) or die("Connecting to MySQL failed"); mysql_close($conn); ?>this is my code...But chrome says server error... and may be down... show more <?php
$password = "rinik";
$hostname = "localhost";
$database = "root";

$conn = mysql_connect($hostname, $username, $password)
or die("Connecting to MySQL failed");

mysql_close($conn);

?>this is my code...But chrome says server error... and may be down or not properly configured..
please help me connect.... and i am beginner
6 answers 6