MySQL Forums
Forum List  »  PHP

Connect Error 1045 using mysqli
Posted by: Sid Childers
Date: August 20, 2010 12:41AM

Hi,

I've created the following PHP code block and am trying to run it on my PC and attempting to connect to MySQL on a remote FreeBSD server. When I run this from my PC, I receive connect error 1045 Access denied for 'dbuser'@'mydomain' (using password YES). I am able to login to mysql using dbuser via shell access.

<?php
/* Set Variables */
$host="myhostip";
$db="dbname";
$username="dbuser";
$pass="mypass";

/* Attempt to connect */
$mysqli=new mysqli($host,$username,$pass,$db);
if (mysqli_connect_error()){
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
echo 'Success... ' . $mysqli->host_info . "\n";

$mysqli->close();

}
?>

Can anyone suggest what I need to check to rectify this problem? dbuser has been granted database priviliges from any host (using '%' on grant table).

Thanks,
Sid

Options: ReplyQuote


Subject
Written By
Posted
Connect Error 1045 using mysqli
August 20, 2010 12:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.