1

I have a situation where it would be ideal to have the database on separate hosting. Just because the host of the current site does not offer mysql. I cannot move the site (for a company)

Can I install wordpress on current hosting in a sub domain and have the database on another host? I have never used anything except “localhost” in the wp-config file? Thank you!

3 Answers 3

2

Yes - absolutely. Simply enter the appropriate hostname and credentials in wp-config.php. Instead of the default localhost use the hostname provided by your database provider.

Example:

define( 'DB_HOST', 'mysql.example.com:3307' );

https://codex.wordpress.org/Editing_wp-config.php#Set_Database_Host

1
  • And also make sure that your external database host allows remote connections and is secure. Apr 29, 2022 at 9:23
0

In theory you can. You can specify the hostname or ip address of the DB server and communicate with it.

In practice this is unlikely to work well because:

  1. Performance might suck. The speed of information transfer on the same server or in a LAN is much higher than what you will get when you need to communicate over the internet

  2. You will have to leave the DB open to attacks. DBs are rarely exposed directly to the internet and I am not sure how good is MySQL security track record, but even in the best case you will have to worry about attacks on two servers instead of one.

Short version: don't do it. If the hosting sucks you either need to go away or select a different CMS that fits better what you can get from the hosting

0

This question to my opinion is very important. I still do research on how to store the data on a specific local RAID. I dont think there is going to be a lack of performance doing so. If wordpress is on a RAID-10 and the database on a RAID-5 HDD within local hardware I am curious to know what can be wrong?

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.