Substituting PostgeSQL for MySQL?

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?

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
May 26, 2023

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!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel