Report this

What is the reason for this report?

Substituting PostgeSQL for MySQL?

Posted on May 26, 2023

For a variety of reasons, I need to use PostgreSQL. I will naturally use the DO hosted version.

  1. please confirm that this will work generally with your hosted WordPress (since it does not with my current provider, WPEngine)?; and

  2. is there an easy way to set this up as a droplet similar to what you’ve described in the article, but substituting out MySQL?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

There are no restrictions on the DigitalOcean side, you can spin up a WordPress Droplet and then create a Managed Postgres Cluster.

With the DigitalOcean Droplets you do have root access, so you will be able to make all of the necessary changes that you need and install any additional packages that might be required.

However, there are a few things to keep in mind according to the official WordPress documentation:

  1. Current codebase is very MySQL-centric. While WordPress does use the ezSQL class to implement database calls, this cannot properly be called an abstraction layer. Differences in SQL syntax implementations among different databases (whether literals are surrounded by quotes, limit query syntax, case sensitivity, etc.) are not cared for by ezSQL, which simply offers a generic “query” call. This means that a large number of queries would have to be rewritten, a large task.
  2. Database driven plugins depend on the current implementation and also use MySQL-centric code. Even if the WordPress code were to be rewritten to support a full database abstraction layer, any sudden shift in the database implementation will likely break other plugins that rely on database access.
  3. Current standard database abstraction layers (ADOdb, Pear DB) are very large and complex, they would represent dependencies as large as or larger than WordPress itself. This could reduce WordPress’ portability and ease of installation.

I would personally stick to MySQL due to the technical debt that might come after implementing Postgres, but I will be very curious to hear why you need to use Postgres with WordPress?

With other PHP frameworks like Laravel, both Postgres and MySQL are natively supported, but with WordPress, it might be a challenge.

Hope that this helps!

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.