ID: 47606 Updated by: j...@php.net Reported By: hugo at 1key dot nl -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Debian 4.0 PHP Version: 5.2.9 New Comment:
Bugs in phpmysql are not bugs in PHP. Previous Comments: ------------------------------------------------------------------------ [2009-03-09 16:06:22] hugo at 1key dot nl Description: ------------ <?php mysql_connect("localhost", "user_name", "p...@ssw'ord") or die (mysql_error()); /* Gives this error: -- Access denied for user 'user_name'@'localhost' (using password: YES) */ ?> please note the special characters in the password. When you try to connect using this command you get the error even though you can connect using phpmyadmin, commandline mysql etc. When you change the double quotes to single quotes the problem is solved. It might be of interest to those used to set strings in double quotes. <?php mysql_connect('localhost', 'user_name', 'p...@ssw\'ord') or die (mysql_error()); // Works perfectly ?> It is not really a bug, or at least i can easily work around it, but I was not allowed to submit it as a usernote and got the message i should report a bug.. Reproduce code: --------------- --- >From manual page: function.mysql-connect --- <?php mysql_connect("localhost", "user_name", "p...@ssw'ord") or die mysql_error()); /* Gives this error: -- Access denied for user 'user_name'@'localhost' (using password: YES) */ ?> Expected result: ---------------- A connection to the database Actual result: -------------- Access denied for user 'user_name'@'localhost' (using password: YES) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47606&edit=1