Page 1 of 1

[HELP!] MySQL Access denied

PostPosted: 13. July 2009 06:10
by cpeter
There is some new "bug" that you must specify Host for new MySQL user, "Any host" won't work and will get access deny error when try to connect.

1) Fresh new install XAMPP

2) phpMyAdmin -> Create new user demo with password demo for Any host, also check "Create database with same name and grant all privileges"

3) Create test php file "demo.php"
Code: Select all
<?php
$link = mysql_connect('localhost', 'demo', 'demo');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>


4) Browse "demo.php", get error
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'demo'@'localhost' (using password: YES) in D:\xampp\htdocs\demo.php on line 3
Could not connect: Access denied for user 'demo'@'localhost' (using password: YES)


5) Change user demo to localhost

6) Browse "demo.php", get echo
Connected successfully


This is new "bug" since XAMPP v1.7 (or 1.6x), why?