Unable to connect to database

I don’t have PHP installed in my local server; it is in the remote server, so, I make my tests transferring the web pages from my disk to the server. When I tried to establish connection with a database there with Mysql_connect, I receive the error msg:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘acaletic_luisi’@‘box243.bluehost.com’ (using password: YES) in /home/acaletic/public_html/lma/test2Jan22.php on line 7
Unable to connect to database

I have tried changing the strings without good results, I can access the database trhu PHPMyadmin. I don’t know if it is a mistake in the strings or of I need to download a driver or what.
Thanks for any help.
This is the code:[code] <?
$DBhost = “www.acaletics.com”;
$DBuser = “acaletic_luisi”;
$DBpass = “********”;
$DBName = “acaletic_luis”;
$table = “Nombres”;
mysql_connect($DBhost,$DBuser,$DBpass) or die(“Unable to connect to database”);

@mysql_select_db("$DBName") or die(“Unable to select database $DBName”);

$sqlquery = “INSERT INTO $table VALUES(’$id’,’$name’,’$telephone’,’$birthday’)”;

$results = mysql_query($sqlquery);

mysql_close();

print “”;
print “

You have just entered this record

”;
print “Name : $name
”;
print “Telephone : $telephone
”;
print “Birthday :$birthday”;
print “”;
?>[/code]

I am a beginer also but from what i am looking at it looks like your dbhost is wrong. instead of http://www.acaletics.com try: box243.bluehost.com

when you are in your phpmyadmin at the top it will show server: (this will be your database(dbhost));

Doesn’t work neither putting:

$DBhost = “box243.bluehost.com”;
$DBuser = “luisi”;
$DBpass = “********”;
$DBName = “luis”;

Neither the prefix acaletic_ in front of user, pass and DBname

What I see when I am in the PHPMyadmin is http://www.acaletics.com:2082/3rdparty/ … /index.php
I tried setting DBhost to http://www.acaletics.com:2082 too and then the msg says it can’t connect the server

Hi,

if the web server and DB are on the same machine, then try using ‘localhost’ as the host. Some hosts will block outside access of the databases for security reasons. If you are trying to access the DB from another machine, then you might have to set it up to allow access from a specific address (if there is a cpanel, you should be able to do this from in there).

ps. you should NEVER post all of your info as you have provided in your first post. you should at the very least block out your password from anyone else.

Usually you have to put acaletic_ in front of user and DB

I have tried those ways too and doesn’t work. Putting the prefix acaletic_ in all the params; changing the host variable in many ways. :cry: What I have noticed is that sometines it seems that recognize the server and the message is ACCESS DENIED to the Database; instead of "Can’t connect to MySQL server on ‘www.acaletics.com’ (4) " as in other tests. Yes, the database is in the remote server too.
Example of this other msg whwn it seems that the problem is not the host param:

$DBhost = "www.acaletics.com";

$DBuser = “acaletic_luisi”;
$DBpass = “********”;
$DBName = “acaletic_luis”;

Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘acaletic_luisi’@‘box243.bluehost.com’ (using password: YES) in /home/acaletic/public_html/lma/test2Jan22.php on line 7
Unable to connect to database

$DBhost = “www.acaletics.com”;
$DBuser = “luisi”;
$DBpass = “********”;
$DBName = “luis”;
$table = “Nombres”;

result:Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘luisi’@‘box243.bluehost.com’ (using password: YES) in /home/acaletic/public_html/lma/test2Jan22.php on line 7
Unable to connect to database

PS. Thanks for the advice about the password, but I am not worried because that is only a test database.

This is not something we can help you fix. Your best bet would be to contact your provider and have him provide you the correct login credentials (and set the correct privileges).

That was right; that’s what we did and it was solved. The privileges were incorrect for the user created.

Besides, the host parameter should be localhost, and the other parameters (except the password) should have the prefix acaletic_
Thanks to everybody.

Sponsor our Newsletter | Privacy Policy | Terms of Service