Bluehost.com Web Hosting $6.95

Problem connecting to remote MySQL Server

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-03-2003
Donald Tyler
 
Posts: n/a
Default Problem connecting to remote MySQL Server

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
Reply With Quote
  #2 (permalink)  
Old 11-03-2003
Rob Adams
 
Posts: n/a
Default Re: Problem connecting to remote MySQL Server

"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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:47 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0