WordPress + MySQL

Quickly setup a WordPress Droplet with a managed MySQL database, perfect for launching websites quickly. When you launch this bundle you’ll deploy a Droplet pre-configured with WordPress and attached to a managed PostgreSQL database.

Use Cases

Using a WordPress Droplet on DigitalOcean with a managed MySQL database is a popular and efficient way to create and manage content-heavy websites. Here are some use cases where this setup is particularly beneficial:

  • Blogging Platforms
    • WordPress provides a seamless blogging experience with customizable themes, plugins, and content management tools. Using a managed MySQL database ensures fast content retrieval and data stability, especially as the blog grows in posts and traffic.
  • Online Communities or Forums
    • WordPress, combined with plugins like bbPress or BuddyPress, enables easy forum and community site setup. A managed MySQL database can handle user-generated content, profiles, and interactions, offering a reliable backend for community engagement and growth.
  • E-commerce Sites
    • WordPress, combined with WooCommerce, allows you to add products, manage inventory, and process payments with ease. A managed MySQL database can handle complex product, order, and customer data reliably, supporting smooth transactions and scaling as customer numbers increase.

Software Included

Package Version License
WordPress 6.4.1 GPL 2
Apache 2.4.52 Apache 2
MySQL server 8.0.35 GPL 2 with modifications
PHP 8.0.30 PHP v3.01
Fail2ban 5.2.1 GPL 2
Postfix 3.6.4 IBM Public
Certbot 1.21 Apache 2

Deploying this Offering using the Control Panel

Click the Deploy to DigitalOcean button to deploy this offering. If you aren’t logged in, this link will prompt you to log in with your DigitalOcean account.

Deploy WordPress + MySQL to DO

Getting Started After Deploying WordPress + MySQL

On your first SSH login to the droplet or launch of the Droplet console of your WordPress Droplet 1-Click, you will be greeted by a WordPress setup script.

If you do not have a Domain yet you can enter the IP address of your Droplet into the setup script when prompted for the Domain/Subdomain instead.

The first step is to enter your domain name. Make sure that your domain is pointing to the new droplet IP. If your DNS is managed by DigitalOcean, it should look like this:

WordPress DNS Example

The DNS Host may be the same company you registered the domain with or another entity you designate. To connect your DNS hosting to DigitalOcean, check out this guide.

Once your A record is set up, you are ready to enter your domain in the script:

This script will copy the WordPress installation into
Your web root and move the existing one to /var/www/html.old
--------------------------------------------------
This setup requires a domain name.  If you do not have one yet, you may
cancel this setup, press Ctrl+C.  This script will run again on your next login
--------------------------------------------------
Enter the domain name for your new WordPress site.
(ex. example.org or test.example.org) do not include www or http/s
--------------------------------------------------
Domain/Subdomain name: wordpress-example.com

Next, the script will ask you user-related data:

Now we will create your new admin user account for WordPress.
Your Email Address: [email protected]

Username: example

Password: 

Blog Title: My Example Blog

Is the information correct? [Y/n] y

After you acknowledge data is correct, the script will ask if you want to configure HTTPS automatically for your droplet. We highly recommend setting HTTPS since using a domain is useless without it.

You will need to provide the email address which will receive security and renewal notices:

Would you like to use LetsEncrypt (certbot) to configure SSL(https) for your new site? (y/n): y
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): [email protected]

Finally, after reading the LetsEncrypt Terms of Service and selecting whether to share or not your email address with the Electronic Frontier Foundation, the script will ask you which domain names would you like to activate HTTPS for:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.4-April-3-2024.pdf. You must agree in
order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: n
Account registered.

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: wordpress-example.com
2: www.wordpress-example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1,2
Requesting a certificate for wordpress-example.com and www.wordpress-example.com

Consider activating HTTPS for both naked and WWW versions of your domain by specifying 1,2.

WordPress will take a few minutes to set up plugins and finish installation, after that you can access your fresh WordPress Droplet by typing your domain name in the browser. For accessing the admin console, use https://%YOUR_DOMAIN%/wp-admin.

If you entered an IP address instead of the Domain name you can access the admin console by using https://%YOUR_IP%/wp-admin instead.

Access your Managed Database from your Droplet

To test the connection to a managed MySQL database from a WordPress droplet, access your droplet via SSH, then use the mysql command with your database credentials to attempt a connection; if successful, you’ll be able to interact with the database, otherwise, you’ll receive an error message indicating the connection failed, prompting you to check your database details in the WordPress configuration file (wp-config.php) for accuracy.

Key steps:

  • Access your droplet: Log in to your droplet using SSH with your credentials.
  • Run the mysql command:
mysql -u <database_username> -p <database_host> -P <database_port> 
  • Replace <database_username> with your database username.
  • Replace <database_host> with the hostname of your managed MySQL database.
  • Replace <database_port> with the database port (usually 3306).
  • Enter your password: When prompted, type your database password and press enter.
  • Check for connection success: If the connection is successful, you’ll be presented with a MySQL prompt, indicating you can now interact with your database.