This is a discussion on Problem connecting to remote MySQL Server within the PHP General forums, part of the PHP Programming Forums category; Hi, I am publishing a site I have developed and I am having problems with the scripts being able to ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I am publishing a site I have developed and I am having problems with the scripts being able to access the remote MySQL server. When I try to connect using the PHP scripts I just get an error saying that access is denied. I can access it fine from my machine using PHPMyAdmin so I know that remote access is being allowed. I have also connected to the web hosting server via SSH and have connected successfully to the MySQL server via the MySQL client at the terminal from that machine. So I know the server that the scripts are running on also has access to the MySQL server. Here is my script. Please let me know if you have any ideas why this would be happening: ----------------------------------------- <?PHP /************************************************** ********************* ************** * Connects to a MySQL database using the Belvedere account * ************************************************** ********************** *************/ function DBMS_CONNECT() { global $Site_Settings; // Connect To DBMS $Connection = mysql_connect($Site_Settings['DB_Host'], $Site_Settings['DB_UserName'], $Site_Settings['DB_Password']) or SQL_KillScript("Connecting to DBMS",$Connection); // Select DB if (!mysql_select_db($Site_Settings['DB_Name'],$Connection)) SQL_KillScript("Selecting Database",$Connection); // Return the connection variable return $Connection; } ?> ----------------------------------- Here is the error message: MySQL Error 1044 : Access denied for user: '**USER**@%' to database 'Belvedere' ----------------------------------- My DB_Host is specified as a domain name. e.g. db1.myhost.com |
|
|||
|
"Donald Tyler" <dtyler@frazerbilt.com> wrote in message
news:00b301c3a22e$3820b9d0$a600000a@ChekoteTablet. .. > Hi, > > I am publishing a site I have developed and I am having problems with > the scripts being able to access the remote MySQL server. When I try to > connect using the PHP scripts I just get an error saying that access is > denied. > > I can access it fine from my machine using PHPMyAdmin so I know that > remote access is being allowed. PHPMyAdmin doesn't necessarily mean that remote access is allowed. A user in MySQL may be able to access the database from the localhost, but not from anywhere else. In your case it looks like you may have the same username defined twice, but with different levels of access. User@localhost access allowed to database Belvedere. User@% access not allowed to database Belvedere. Just a guess. > I have also connected to the web hosting server via SSH and have > connected successfully to the MySQL server via the MySQL client at the > terminal from that machine. So I know the server that the scripts are > running on also has access to the MySQL server. > > Here is my script. Please let me know if you have any ideas why this > would be happening: > > ----------------------------------------- > > <?PHP > > /************************************************** ********************* > ************** > * Connects to a MySQL database using the Belvedere > account * > ************************************************** ********************** > *************/ > function DBMS_CONNECT() > { > global $Site_Settings; > > // Connect To DBMS > $Connection = mysql_connect($Site_Settings['DB_Host'], > $Site_Settings['DB_UserName'], $Site_Settings['DB_Password']) > or SQL_KillScript("Connecting to DBMS",$Connection); > > // Select DB > if (!mysql_select_db($Site_Settings['DB_Name'],$Connection)) > SQL_KillScript("Selecting Database",$Connection); > > // Return the connection variable > return $Connection; > } > > ?> > > ----------------------------------- > > Here is the error message: > > MySQL Error 1044 : Access denied for user: '**USER**@%' to database > 'Belvedere' > > ----------------------------------- > > My DB_Host is specified as a domain name. e.g. db1.myhost.com |