Hi All,

I have just started using XAMPP for my PHP and MYSQL work. I tried to connect to the MYSQL database with the code below.


Code:
<html>

<head>

<title>How to connect to a database</title>

</head>

<body>

<?php
$username = "root";
$password = "root";
$hostname = "localhost"; 

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password) 
  or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
?>

  
</body>
</html>


But I got the following error.

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\mywork\connect.php on line 18
Unable to connect to MySQL

My questions are as follows:


1) What is wrong with my log in details? Where did the 'YES' password come from?

2) If anyone has used XAMPP before, could you let me know how or where to change the username and password?

3) How do I connect to a database succesfully?

I will greatly appreciate your help please.

Menre