June 20, 2021

MariaDB howto

MariaDB is a forked version of MySQL with some other features. It works basically the same, but there are some oddities.

apt-get install mariadb-server
mysql_secure_installation

Now create a database and user:

create database testdb;
create user 'testuser'@localhost identified by 'password';
grant all on testdb.* to 'testuser' identified by 'password';

Now create a table and put some stuff in it:

create table customers (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT);

Reset root password

systemctl stop mariadb
mysqld_safe --skip-grant-tables &

Now login to mariadb as root:

mysql -u root 
use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
flush privileges;
exit
systemctl start mariadb