By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,965 Members | 1,757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,965 IT Pros & Developers. It's quick & easy.

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'debscrof'@

P: 3
I created a user "test1" (which then got the username "debscrof_test1" from CPanel), a password for the user "test2", and then added the user to a new database "testdb" with all priviliges

Then a simple script to connect to the database (as I am trying to locate the source of the errors), as per below:

[PHP]<?php
$dbhost = "localhost";
$dbuser = "debscrof_test1";
$dbpass = "test2";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'debscrof_testdb';
mysql_select_db($dbname);
?>[/PHP]

Have tried with " and ' around the values, with 127.0.0.1 as the host... still with the same error message:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'debscrof'@'localhost' (using password: NO) in /home/debscrof/public_html/testdb.php on line 6
Error connecting to mysql

...any suggestions why I cannot connect? (and why it says password: NO)!


Many thanks
Nov 25 '07 #1
Share this Question
Share on Google+
1 Reply


mwasif
Expert 100+
P: 801
Have tried with " and ' around the values, with 127.0.0.1 as the host... still with the same error message:
" and ' do not make a difference.

Use mysql_error()
[PHP]$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql. Error: '.mysql_error());[/PHP]

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'debscrof'@'localhost' (using password: NO) in /home/debscrof/public_html/testdb.php on line 6
Did you notice that in the error message it is saying user 'debscrof'@'localhost'. May be are looking into a wrong PHP. Create a new file and use the code you posted above with the modification I have advised.

Run this new PHP file and post back what is the result.
Nov 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.