Install MariaDB in Debian Stretch

December 21, 2018

[ linux  debian  mysql  mariadb  ]

Note that this article for local installation of Maria DB or MySQL. It’s intended to help you get up and running with the database locally and is not intended as a production tutorial. If you need to use either in a production environment, please contact a professional.

Step 1: update and install

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install mariadb-server mariadb-client

Step 2: (Optional) Run the secure installation. Doesn’t hurt to see the options for future reference.

sudo mysql_secure_installation

Step 3: allow running as root without a password:

$ sudo mysql -u root -p

From inside the database shell:

use mysql;
update user set plugin='mysql_native_password' where user='root';
flush privileges;

Step 4: Install development libraries (e.g. for mysql2 gem)

$ sudo apt install libmariadbd-dev