Skip to main content

Setting up MariaDB database + phpMyAdmin securely in the cloud in less than 1 minute

In short

For most applications you will need to store data, and a popular service to use for that is MariaDB. In this article we'll be looking at how you easily create and set up a database in the cloud (Microsoft Azure) without having the hassle of lengthy server, network and security setup and managing a Kubernetes cluster. Also, we’ll be adding a phpMyAdmin service to access and administrate your newly MariaDB database.

Getting started

If you already have a mogenius account, proceed to the next step. Otherwise you can sign up here: mogenius sign-up

Sign up for mogenius - it's free and you can get started right away. Once you've created your account, you can create a new cloudspace that contains all your services and databases for a project, like MariaDB. The services all reside in your secure cloudspace and can communicate with each other (Kubernetes namespace isolation). This is a convenient way to build a cloud-native software project that consists of one or more interconnected microservices. Once you have confirmed your email and phone number, you can create a new cloudspace:

enter image description here

Choose a name for your cloudspace and select the free tier to get cloud resources at no charge, or you can also choose a subscription to upgrade your resources when you create the cloudspace or upgrade at a later stage.

enter image description here

Adding MariaDB to your cloudspace

Now are ready you to set up a MariaDB database! On the next overview page, you will see all your cloudspaces. Click on the name of the cloudspace where you want to set up your MariaDB database. On the next page, click "Service Library" in the left menu:

enter image description here

mogenius will automatically create and setup MaruaDB for you and add a dockerfile in one of your Git repositories. Click on “Add Service” underneath the MariaDB logo on the next page.

enter image description here

If this is the first time you are deploying a service, we need to connect your cloudspace to your repository. Click on “Connect Github” which will ask you to grant permission to access your Github repositories.

enter image description here

You will only need to do this once, your mogenius cloudspace is now connected to your GitHub account, and can access your repositories.

enter image description here

Next, you can either use an existing empty repo or create a new one by clicking the “+” symbol. Select a name for the new repo and create it.

Specifiy a name for the database service, select the branch in your repo and stage in your cloudspace you want to use.

Now we need to set the environment variables. Most of them are pre-filled for you, and you can adjust them optionally.

enter image description here

Three fields are mandatory: MariaDB_User, MariaDB_Password and MariaDB_ROOT_Password, with that other services can access MariaDB database. You can choose your passwords from your list of secrets, create a new one or simply have one generated for you. If you create a new secrent, they will be stored in your mogenius KeyVault for easy a ccess later on. To have a new secret generated automatically, click the wizard-button:

enter image description here

You can also change the resources like CPU cores, memory and persistent storage. By default we have pre-configured these for optimum and efficient usage of your resources.

Now, simply click "Save". Your MariaDB database will now be built, the dockerfile added to the specified Git repository, and deployed to your cloudspace at the same time so you can start using it almost immediately. Once the setup routines, build and deployment process are complete (usually a few minutes at most), you can start using your MariaDB database at the specified URL. You can find all the details on your service's overview page, where you can also customize the resources and scale by adding additional instances for your service.

enter image description here

That’s it! You have created your first MariaDB database service and it will be available to access by other services in your cloudspace.

Adding phpMyadmin for database administration

Go back to the Service Library to add another service to your cloudspace.

There, select phpMyAdmin from the list of services.

enter image description here

enter image description here

Next, you can either use an existing empty repo or create a new one by clicking the “+” symbol. Select a name for the new repo and create it.

Specifiy a name for this service, select the branch in your repo and stage in your cloudspace you want to use.

Now we need to set the environment variables, two of which are mandatory: Root password and Hostname, which is the MariaDB service you just set up. Select the right secret for MYSQL_Root_PASSWORD from the dropdown menu (the one you just created named MariaDB_ROOT_Password) and the MariaDB service you just set up from the dropdown menu for host name.

enter image description here

Now, simply click "Save". Your phpMyAdmin service will now be built, the dockerfile added to the specified Git repository, and deployed to your cloudspace at the same time so you can start using it almost immediately. Once the setup routines, build and deployment process are complete (usually a few minutes at most), you can start using your phpMyAdmin service at the specified URL. You can find all the details on your service's overview page, where you can also customize the resources and scale by adding additional instances for your service. enter image description here

You can how access this service shown at the URL, which will look something like this: https://phpmyadmin-service-prod-sundaysbest-qx6r52.dev.mogenius.io/

Click on the URL to access your phpMyAdmin user interface. Please note: The admin user name is "root". You can now copy the password for the root user from your mogenius KeyVault and log in. You can now copy the password for the root user from your mogenius KeyVault and log in.

enter image description here