===== Install MariaDB ===== To install MariaDB, run the command below; # apt-get install mariadb-server mariadb-client When installed, MariaDB is started and enabled to run on system boot. # systemctl is-enabled mariadb enabled # systemctl status mariadb ● mariadb.service - MariaDB 10.3.15 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2019-07-18 15:31:35 EDT; 9min ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 2356 (mysqld) Status: "Taking your SQL requests now..." Tasks: 31 (limit: 1150) Memory: 76.4M CGroup: /system.slice/mariadb.service └─2356 /usr/sbin/mysqld After installing MariaDB database server, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots. # systemctl stop mariadb.service # systemctl start mariadb.service # systemctl enable mariadb.service ==== Database location ==== Database is located at: # cd /var/lib/mysql/ ==== Check location used config file ==== The location of the used config file can be found by: /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options" ==== MariaDB initial Security ==== By default, MariaDB uses unix_socket plugin for authentication and thus, it doesn’t require password to login. You can simply run mysql or mysql -u root to login to MariaDB server. # mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 48 Server version: 10.3.15-MariaDB-1 Debian 10 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> You can now run the mysql_secure_installation script to remove MariaDB test databases, anonymous users and disallow remote root login. To run the script, just run the command below # mysql_secure_installation When prompted, answer the questions below by following the guide. Enter current password for root (enter for none): Just press the Enter * Set root password? [Y/n]: Y * New password: Enter password * Re-enter new password: Repeat password * Remove anonymous users? [Y/n]: Y * Disallow root login remotely? [Y/n]: Y * Remove test database and access to it? [Y/n]: Y * Reload privilege tables now? [Y/n]: Y * Restart MariaDB server To test if MariaDB is installed, type the commands below to logon to MariaDB server # sudo mysql -u root -p Then type the password you created above to sign on… if successful, you should see MariaDB welcome message ==== Remote Access ==== By default the remote access is disabled. In order to enable remote access make the following changes to the configuration file: # nano /etc/mysql/mariadb.conf.d/50-server.cnf Disabled the line: bind-address = 127.0.0.1. #bind-address = 127.0.0.1 #And add 2 new lines: skip-networking=0 skip-bind-address