• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Configure Plesk to call a different DB

Ed3000

New Pleskian
Hello, been having issue connecting my wordpress site to external database, after more research it seems that the issue is that even I if specify a correct DB name, user password on my Wordpress config files, Plesk tries to call / use local database and return error of user denied..I have tested connections from Server A where all files are and Server B / database via ssh and additionally I add a new DB server in Plesk to test connection and I can access the remote server, but when it goes to retrieve files for my site, it try's local DB instead of the one specified on Wordpress confg..I have bind-address on plesk Server A set to listen to the IP of the external DB...Here is the error log sample

PHP Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'wpuser to external db'@'206.189.xxx.xxx <----its calling IP of server A not the IP of the external DB as specified on Wordpress confg file so of course, the user name is not on local DB its on external so there is always "Error can not connect"...

Any idea or file I can change to fix this? I attached a screen shot.

Thank You
 

Attachments

  • Screenshot.png
    Screenshot.png
    80.9 KB · Views: 7
Go to Hosting Parameters of Service Plan on which this subscription is based and check Default Database there. Change it to the external database server and resync subscriptions of this Service Plan.
 
Hello IgorG, I tried that before and did not work, but have never resynced, that might be it, however, I only have my site on there and no subscriptions tab or option..I looked at Plesk Migrator to see if possible but seems not...You think I can change that on the phpmyadmin psa table?..If so, what should I change, just the IP address?...Thank You
 
Did you enter the IP address or a host name in your Wordpress "database host" configuration?
Normally it should be this entry:
define( 'DB_HOST', 'localhost' );
However, if you do not enter an IP address for the external host, did you check that your server resolves the host name that you have entered correctly to the external server?

But here is more likely cause for what you are describing:
To me it looks like this error message is coming from the database server. It does not let 'wpuser to external db' login, because a permission set is missiong for 'wpuser to external db'@'206.189.xxx.xxx'. You might have added "wpuser to external db'@domainname, but that would be something different for permission checking. If the database looks for the user at the given IP address, you must make sure that the user is listed with the IP address as the source of the request in its permissions. So likely what you are seeing is not actually that your site does not connect to the external database. It does connect to it, but in the external database, permissions are missing to let your user from your local IP connect to that database.
 
Hello Peter, thanks for the reply, I think what might be happening has something to do with permissions as you mentioned. During testing, all works well except on the frontend once the site actually tries to connect. Both servers are on different network so its causing permission issues, Im going to move the servers into a private network, Seems the servers are blocking each other due to security.

Thank You
 
Back
Top