Question

How to connect DigitalOcean MySQL database cluster with mybb application?

I was following this tutorial: https://youtu.be/0Solyc0Jwgo and instead of having a locally hosted mysql database, I’ve used my db cluster on digital ocean (I’m new to DigitalOcean). I set everything up with the permissions on my vps, created the user on mysql, so far so good. But when I enter my database details, it tries to connect and just times out, when I refresh the page ,I am at the start again of the set up dialog of mybb. I suspect it could be because I am not using the ca-certificate digitalocean has provided, but I have no idea how to make mybb use it. I have found several sources for setting https (ssl/tls) for your vps to work with mybb, but none to use the ca-cert to connect to a mysql database. Any help would be appreciated, I’ve been stuck for days with this problem.


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
January 24, 2024

Hey Nickyesulol,

Indeed, connecting your MyBB application to a DigitalOcean Managed MySQL Database Cluster involves a few key steps to ensure secure and proper communication between your application and the database.

The issue you’re facing with the timeout during connection attempts is likely related to not using the provided CA certificate for SSL/TLS encryption. There are a few things that I could suggest checking:

  1. Download the CA Certificate:

    • First, download the CA certificate provided by DigitalOcean for your database cluster. This certificate is crucial for establishing a secure connection to the database.
    • You can find and download this certificate from your DigitalOcean control panel, under the “Databases” section. Select your database cluster and look for the SSL/TLS settings or the security section to find the certificate.
  2. Upload the CA Certificate to Your Server:

    • Upload the downloaded CA certificate file to your VPS where MyBB is hosted. Choose a secure and accessible location, like /etc/ssl/certs/.
  3. Configure MyBB to Use the CA Certificate:

    • MyBB’s database configuration is usually in the inc/config.php file. You need to edit this file to add the necessary details to connect to your DigitalOcean MySQL database, including the path to the CA certificate.

    • Open inc/config.php and update the database settings. Here’s an example of what the settings might look like:

      $config['database']['type'] = 'mysqli';
      $config['database']['database'] = 'your_database_name';
      $config['database']['table_prefix'] = 'mybb_';
      
      $config['database']['hostname'] = 'your_database_host';
      $config['database']['username'] = 'your_database_username';
      $config['database']['password'] = 'your_database_password';
      
      $config['database']['ssl'] = [
          'key'    => null,
          'cert'   => null,
          'ca'     => '/etc/ssl/certs/your_ca_certificate.crt',
          'capath' => null,
          'cipher' => null
      ];
      

      In this configuration, replace your_database_name, your_database_host, your_database_username, your_database_password, and your_ca_certificate.crt with your actual database details and the name of your CA certificate file.

  4. Check Database Access and Firewall Rules:

    • Make sure that your Droplet’s IP address is allowed to access the DigitalOcean MySQL database via the trusted sources on the managed cluster. You can configure this in the “Networking” or “Security” settings of your database cluster in the DigitalOcean control panel if you are using a Cloud Firewall.
  5. Retry the MyBB Setup:

    • After making these changes, try running the MyBB setup again. It should now be able to connect to the DigitalOcean database using the provided SSL/TLS settings.

If you still face issues, check the logs on your Droplet and MyBB for any error messages that can provide more insights. Look for errors related to database connections or SSL/TLS handshakes and feel free to share them here so I can try to advise you further!

Best,

Bobby

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