Problem Connecting to MySQL Database on Production Server
I put my files on my server, but I'm unable to connect to the database. My project works on my local machine, but not on my production server.
I'm using mysql and php.
I'm getting this error:
[01-Nov-2010 18:27:01] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'dbuser'@'localhost' (using password: YES) in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 20
[01-Nov-2010 18:27:01] PHP Warning: mysql_select_db() [<a href='function.mysql-select-db'>function.mysql-select-db</a>]: Access denied for user 'mysite'@'localhost' (using password: NO) in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 21
[01-Nov-2010 18:27:01] PHP Warning: mysql_select_db() [<a href='function.mysql-select-db'>function.mysql-select-db</a>]: A link to the server could not be established in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on l开发者_高级运维ine 21
[01-Nov-2010 18:27:01] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: Access denied for user 'mysite'@'localhost' (using password: NO) in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 28
[01-Nov-2010 18:27:01] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: A link to the server could not be established in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 28
[01-Nov-2010 18:27:01] PHP Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 31
[01-Nov-2010 18:27:01] PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/zendamf_remote_quiz/MyData.php on line 46
Does this error mean that my password is incorrect? Any suggestions?
Thank you.
-Laxmidi
Either your user or password is wrong (or even your server, but that's more rare).
Be aware that there are two users on that stacktrace, 'dbuser' and 'mysite', could be related to that?
Thank you for the help. I made a dumb error. My host prefaces the user name and the database name with the site's user name in order to avoid conflicts. I forgot about that.
精彩评论