469,160 Members | 1,990 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,160 developers. It's quick & easy.

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

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
1 2814
mwasif
801 Expert 512MB
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.

Similar topics

7 posts views Thread by Frogman | last post: by
8 posts views Thread by Wilfred Johnson | last post: by
19 posts views Thread by Michael | last post: by
14 posts views Thread by brett | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.