472,133 Members | 1,173 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

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 2970
mwasif
802 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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.