• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

[solved] Wordpress connecting to external DB

Johan06

New Pleskian
Hello,

Since I transfered a wordpress to a new server with Plesk 12.5, my custom plugin who do a connection to an external DB to get infos doesn't work.

Where should I check to enable/disable a configuration in the plesk panel to solve this ?

Regards
 
What do you mean exactly "doesn't work"?
First of all make sure that this external database server is accessible from Plesk server - port and IP address is not firewalled, etc.
 
Well,

I got 3 servers with :
Website A on plesk 11.0.9
Website B on plesk 12.0.18
Website C on plesk 12.5

Website B and C do a connection to Website A Database to display some datas.
Website B works. (it display datas)
Website C display nothing (no datas and no errors displayed too...)

Before doing more deep test on the PHP code or other possiblity, I wanted to know if there was a configuration in plesk panel who can solve it.
Because Website C was on the same server than Website B and worked (displayed the data) so it's should be a problem with a security config i guess...

I use the wordpress function wpdb() to do the db connection.

The external database is accessible.
 
First of all, your mysql configuration needs to be changed that it doesn't listen only on localhost, so head to my.cnf and comment out bind_address/restart mysql. my.cnf location depends either if you're on centos /etc/my.cnf or debian/ubuntu /etc/mysql/my.cnf.

After that, it should work (in newer plesk versions you can define user connectivity and permissions per user, but since your website is connection to server A, I don't think you can define that-there). The simplest test would be to connect command line - shell and try to login with your user:

# mysql -u your_user_on_weba -p databasename -h IP_or_hostname_of_website A

you execute the above from web C

Good luck
 
Hi,

Thanks for your post.

I did what you said and I got this message :

ERROR 1130 (HY000): Host 'xx.xx.xx.xx' is not allowed to connect to this MariaDB server

I don't understand why it said that for a remote host


Problem solved. It's my bad.
Got same IP on this server... conflict..
I just deleted it.


Thanks all
 
Because your mysql user on web A exists only as user@localhost or [email protected] - there's no such user as user@webC - so yes, you need to create that user like this:

On webA server connect to mysql:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow`
# CREATE USER 'your_user_on_weba'@'IP_or_hostname_of_website_C' IDENTIFIED BY 'password_of_your_user_on_weba';
# GRANT ALL PRIVILEGES ON databasename.* TO 'your_user_on_weba'@'IP_or_hostname_of_website_C';
# FLUSH PRIVILEGES;

Now you should be able to connect from server webC to webA. Good luck!
 
Back
Top