MariaDB is a free, open-source and one of the most popular relational database system around the globe. It is a drop-in replacement for MySQL database system. However, the structure and indexes of both database systems are same, this will allow you to switch your database from MySQL to MariaDB without having to alter your applications.
In this tutorial, using manually with shell access on a Ubuntu 20.04 multipass on Linux Localhost.
Enabling Remote Access
The steps are as follows:
- Run the “Enable Remote Mysql Access” script on your local or server
- Create a new database and dabase user which contains the word “remote” in the username. Such as “myremotedatabaseuser”
Please note: When using this method you are opening up port 3306 to the world and anyone who can guess your DB username and password may gain access. If you want to restrict users or your firewall port by e.g. IP — then you need to follow the manual setup method below.
If you need to grant remote access to an existing database you will need to grant the appropriate privileges to a new or existing user in MySQL using the command line, or alternatively using phpmyadmin — please see instructions on how to achieve this on the command line in the instructions below.
Verify MariaDB Server
Before starting, make sure the MariaDB server is running by using the following command:
ps -ef | grep -i mysql
You should get the following output:
mysql 595 1 0 04:17 ? 00:00:00 /usr/sbin/mysqld root 1350 1337 0 04:22 pts/0 00:00:00 grep --color=auto -i mysql
By default, the MariaDB server is listening on localhost only for security reasons. You can check it with the following command:
netstat -ant | grep 3306
In the following output, you should see that the MariaDB server is listening on localhost (127.0.0.1):
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN