Probably still the most prominent database solution for web purposes, MySQL is used by many apps, like WordPress and TYPO3. Setting up MySQL and orchestrating it with phpMyAdmin on sloppy.io is as easy as it gets. Let me show you, how it's done.

Logging in to sloppy.io, your dashboard shows an overview of your existing projects. Click “Create a New Project“ to access the creation form for new projects. Every sloppy.io project needs a name, which is also the ID by which it is referred to. You're free to choose, but for the matter of this tutorial, let's stick with “my-mysql-db”.

Each project consists of services. Services are a means to categorize the apps you wish to combine in a project and, like project names, are also absolute IDs for referral. For our purpose, we're going to setup a “backend” service, comprising a MySQL database, and a “frontend” service, consisting of phpMyAdmin.

First, we're going to setup MySQL. Upon typing “mysql” in the Image Path field, a dropdown appears, showing all available Docker Hub images containing the search word. Fittingly, mysql is also the name of the official repository for MySQL on Docker Hub, so that's what we're selecting.

Step 1: Selecting Docker image and Environment Variables

Since MySQL will be running in the background, we can switch off “This is a web app” and continue to setup Environment Variables. The Docker Hub page for MySQL lists all possible variables, but as we're off for a quick start, we'll just go with a MYSQL_ROOT_PASSWORD as Key and a password of your choosing as Value. Now, before we can deploy, head to the Performance tab and up the RAM to at least 512 MB. That's it! Click “Deploy project” and see your instance running successfully in a second.

Step 2: Assigning at least 512 MB RAM to MySQL

Next is phpMyAdmin. Click “Edit project” to return to the creation form, and add the service “frontend” and the app “phpmyadmin”. Again, typing “phpmyadmin” in the Image Path field will yield to the dropdown showing Docker Hub images comprising the search word. The path to the official image in this case is phpmyadmin/phpmyadmin. Select it and continue to “Networking”.

Step 3: Wait for MySQL to run and continue

To access phpMyAdmin via web, a domain is needed. Sloppy.io offers the use of free subdomains of our “sloppy.zone”. If you've already got a domain, here's how you can use it. Right now, we're simply using the name of our project as the subdomain: “my-mysql-db.sloppy.zone”. Note that the subdomain might already be taken, in which case you only need to come up with a different one.

Step 4: Selecting Docker image for phpMyAdmin and Environment Variables

Now, we only need to enter two Environment Variables, before we can deploy phpMyAdmin. PMA_HOST refers to our MySQL container. Entering the Value field, the ID of this container is already shown in a dropbox below, so we just need to select it – neat, right? If you want to enter it manually, type in the IDs of your MySQL app, the service it's filed under and the project – in that order, and separated by dots. Finally, MYSQL_ROOT_PASSWORD is the password we've set up moments ago for MySQL. That's it, click “Update project” and wait for the instance to run.

Step 5: Wait for both apps to run successfully

Entering the URL we've specified into the browser or using the outgoing link in the project overview, phpMyAdmin now pops up and asks for Username and Password. Log in with “root” and our set password, and start working.

Step 6: Open phpMyAdmin and login with your root password

There you have it, a fully operational MySQL database complete with phpMyAdmin administration, created in a matter of seconds using the sloppy.io UI. Let us know if you're having trouble understanding this article or if you'd like to suggest a different topic for a future tutorial.

Here are the links to the Docker Hub images and respective Environment Variables we've been using in this tutorial:

Find out how to manage other databases on sloppy.io

Did this answer your question?