Can't make Mysql connection

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:

<?
$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 "<html><body><center>";
print "<p>You have just entered this record<p>";
print "Name : $name<br>";
print "Telephone : $telephone<br>";
print "Birthday :$birthday";
print "</body></html>";
?>

So are you renting space on the remote server? Is this where the database is located? Some vendors will block outside access to the databases. If the database is on the same machine as the web server, try and use localhost. Otherwise you may have to set the db to allow access from specific addresses (if the web server has cpanel or something similar, you should be able to do it from in there).

By the way, I hope that’s not your real password you have provided all of us with. If so, I would change it right now. :wink:

Yes. It doesn’t matter the password; that DB is only a test. I finally called the provider’s cust service 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