How to configure WordPress with a Managed Database

August 22, 2019 276 views
MySQL Configuration Management Ubuntu

Hey all!

I want to test out the new DigitalOcean Managed MySQL databases, can you tell me what do I have to do in order to configure my WordPress to connect to my Managed MySQL database?

Thank you!

1 Answer
bobbyiliev MOD August 22, 2019
Accepted Answer

Hello,

I would recommend following this great step by step guide by Mark Drake on how to setup your WordPress with a Managed Database:

https://dev.to/mdrakedo/how-to-install-wordpress-with-a-managed-database-on-ubuntu-18-04-3knc

Hope that this helps!
Regards,
Bobby

  • Bobby, There is a key issue with this step-by-step guide, and an issue with Managed Databases as well.

    The default authentication plugin is set to cachingsha2password. This is not currently supported in PHP, see:
    https://www.php.net/manual/en/mysqli.requirements.php

    The recommended workaround is to change the MySQL server settings, changing the default authentication plugin. However, Managed Databases does not expose this.

    How on earth are we meant to use this with WordPress & PHP in general?

    • Hello,

      Indeed this is correct for the default user that comes with your managed database. But you could change that with:

      ALTER USER myuser IDENTIFIED WITH mysql_native_password BY 'mypassword';
      

      Or of course you could create another user and set the password to mysql_native_password:

      CREATE USER 'wordpressuser'@your_server_ip IDENTIFIED WITH mysql_native_password BY 'password';
      

      If you take a closer look at the article you will see that this is explicitly specified there.

      Hope that this helps!
      Regards,
      Bobby

      • Hello, there is another issue with this tutorial. Creating another user and setting the password to mysqlnativepassword works indeed, also GRANT ALL PRIVILEGES on wordpress database to that user also works - what didn’t work for me, following this tutorial up to that point was to FLUSH PRIVILEGES; when I try to do that I get this error:

        ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation

        How to solve this? Shouldn’t the doadmin user have this permission by default?

        Please advise.

        Regards,

        Liviu

        • Hello,

          Unless you are using INSERT on the main user tables, the privileges should automatically reload, which would prevent the need to flush.

          Hope that this helps!
          Regards,
          Bobby

Have another answer? Share your knowledge.