scoopy

Member
Aug 18, 2004
15
0
151
I am trying to setup a site to use a database from another server. The setup is as follows:

Server 1) contains the database I want to use

Server 2) contains the wordpress script

I have added the IP from Server 2 in cPanel under "Add Access Host" on Server 1

I have configured the script on Server 2 like so:

Code:
// ** MySQL settings ** //
define('DB_NAME', 'server1user_wordpress');
define('DB_USER', 'server1cpaneluser');
define('DB_PASSWORD', 'server1cpanelpass');
define('DB_HOST', 'server1.ip');
I have tried all kinds of combos of usernames (including creating a special DB user as "s1cpaneluser_s1DBuser"... but figure the best option is to use server 1's cpanel user/pass)... but it all comes up (on server 2's domain):

"Error establishing a database connection"

I also have tried adding the domain and IP of server 2 in server 1's WHM --> Additional MySQL Access Hosts and the server's phpMyAdmin is showing the remote host in its "User Overview" section.

What am I doing wrong... or what could be wrong here ?

thanks,
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
Do you have port 3308 open on the firewall?

Did you you grant access and usage rights to your user on the remote DB?
 

scoopy

Member
Aug 18, 2004
15
0
151
We have port 3306 open.

Maybe I am not understanding how I should be granting these permissions. The only way I can see doing this from cPanel is this way:

1) Log into cPanel of the server with the database
2) Add a DB user in section, "MySQL Users - Add New User"
3) Choose this user for the database in, "Add User To Database"
4) Check "All Priviledges" option

Then:

1) Log into cPanel of the server with the Wordpress files
2) Update file "wp-config.php" to reflect this user I added on other server (server1cpanelname_user)

Maybe I got the "server1cpanelname" part wrong ? I am using the user name for that cpanel account in that spot for which cPanel automatically adds to any database user I create.

thanks,
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
It's something you need to do as the MySQL administrator.

ON the remote system, log into the command line version of MySQL, as root, and perform the following:


Code:
GRANT ALL PRIVILEGES ON database.* TO [email protected] IDENTIFIED BY 'password';
If cPanel is installed on Server 1, then you can also do that within PHPMyAdmin, on Server 1 when logged into WHM as root.
 

scoopy

Member
Aug 18, 2004
15
0
151
Thanks... that worked :)

Note: had to use server 2's IP... instead of the IP the site is on.