I am getting this error message

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dorcas'@'localhost' (using password: YES) in C:\myweb\dbmysql.php on line 2
Error connecting to database

when i run this code

$con = mysql_connect("localhost", "dorcas", "dorc123") or die("Error connecting to database");
$query = "CREATE DATABASE chene";
$result = mysql_query($query);
mysql_select_db('chene') or die('Cannot select database');

I am using Wampserver 5.

How do I go around this problem?

I use the following code in a db.php which i then require or include in my other files...

<?php
     $username=''User_Name;
     $password='Password';
     $hostname='host_name';
     $databasename='db_name';
     $create='off';
     $prefix='';

// database conection
     $connection = mysql_connect($hostname, $username, $password);
      if (!$connection) {
      echo( "<P>Unable to connect to the " .
        "database server at this time.</P>" );
      exit();
}
      if (! mysql_select_db($databasename) ) {
      echo( "<P>Unable to locate the '$databasename' " .
        "database at this time.</P>" );
      exit();
}
?>

then in lets say page.php I would do the following inside the php tags..

require('db.php');

Have you created a user called dorcas ? Have you given the user "dorcas" all permissions ?
If your answer is no, this might help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.