0

some comments preceding a mysql_connect statement are telling me to modify the values/variable name to my installation. I'm using xamp and looking in php.ini right now. don't really know where the problem is. please advise. Thanks.

php:

$dbhost = 'localhost'; //unlikely to require changing.
$dbname ='publication'; //moify these
$dbuser = 'username'; //variables 
$dbpass = 'password'; //// to your installation
$appname = 'Robot City'; // and preference

mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());

error message:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'username'@'localhost' (using password: YES) in C:\xampp\htdocs\ajaxpagination\testpage.php on line 10
Access denied for user 'username'@'localhost' (using password: YES)
ajreal
  • 46,720
  • 11
  • 89
  • 119
expiredninja
  • 1,397
  • 4
  • 25
  • 45

3 Answers3

2

This has nothing to do with php.ini. You're providing the wrong username/password to mysql, or you've not configured that account properly in mysql.

What does show grants for username@localhost; show when you run that in mysql?

Marc B
  • 356,200
  • 43
  • 426
  • 500
0

Instead of looking into php.ini you have to look into your XAMPP documentation.
I am sure it contains database credentials you have to use.

As a wild guess try to use

$dbname ='test'; //moify these
$dbuser = 'root'; //variables 
$dbpass = '';

But again - refer to the documentation for the actual values.

There is also a chance that you entered them yourself upon the process of the XAMPP installation.

Note that I have never seen this application in my life. I am writing only out of the general idea of how most applications work.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
0

Wrong username and password. Period!!! Try

$dbhost = 'localhost'; //unlikely to require changing.
$dbname ='publication'; //moify these
$dbuser = 'root'; //variables 
$dbpass = ''; //// to your installation
$appname = 'Robot City'; // and preference
Yanki Twizzy
  • 7,771
  • 8
  • 41
  • 68