ID: 31418 Updated by: [EMAIL PROTECTED] Reported By: sam dot boles at acfb dot org -Status: Open +Status: Feedback Bug Type: Documentation problem Operating System: Windows 2000 PHP Version: 5.0.3 New Comment:
I can't believe that this is caused by any difference between ' and ". Is your code really so simple? Don't you use any variables or escape sequences inside strings? Are you using new passwords or old in MySQL? You can check this by "SELECT Password FROM mysql.user WHERE Host = 'localhost' AND User = 'root'". If the password begin with * it's new otherwise it's old. MySQL extension doesn't work with new passwords (but with different error message), MySQLi does. Previous Comments: ------------------------------------------------------------------------ [2005-01-05 21:07:07] sam dot boles at acfb dot org Host is localhost username is root password does not contain '\' or '"'--strictly alphanumeric don't know if this makes any difference, but in the versions that don't work, when the error message prints, it puts both the username and hostname in single quotes such as: Error 1045:Access denied for user 'root'@'localhost' (using password:YES) ------------------------------------------------------------------------ [2005-01-05 20:59:35] [EMAIL PROTECTED] This is very very strange. What username/password are you using?? (or if you don't want to give the password, just say if you are using '\' or '"' chars in it. Nuno ------------------------------------------------------------------------ [2005-01-05 16:46:36] sam dot boles at acfb dot org Description: ------------ Issue Environment: Apache/2.0.52 (Win32) PHP/5.0.3 MySQL client API version 4.1.7 MySQL version 4.1.7 -nt Windows 2000 Server Service Pack 4 When trying to connect to MySQL database using either mysql or mysqli extensions, the server throws this error: Error 1045:Access denied for user 'user_name'@'host_name' (using password:YES). (user_name and host_name in the previous error are actual user and host name in the real error message--these names have been changed to protect the innocent.) This error occurs when connecting via PHP, does not occur when using other MySQL clients. Almost all of the online documentation and examples I found use a syntax with double quotes on the arugments to the connection functions. {$mysqli = new mysqli("host_name","user_name", "password", "database");} It is this double quote syntax seems to be what caused the function not to work in above named environment. As far as I can tell, there are no escape characters or variable interpolations in the actual username, password or databse, so I don't belive that is the issue. Notwithstanding, changing the function arguments to single quotes {$mysqli = new mysqli('host_name' , 'user_name', 'password', 'database');} seems to work perfectly. I have tested this pattern and it is very consistent--double quoted arguments will not work, single quoted arguments function smoothly. A mention of this in the docs or online resources would be helpful. This may be something unique to this configuration, or to my environment. Also, if I am just blind and missed a mention of this in the documentation, please forgive. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31418&edit=1