Lucashemi

MariaDB

2023-02-28

Origins

MariaDB was forked from MySQL to assure that the code base would be free forever, it functions basically the same (all MySQL connectors work with MariaDB) with some additional features like improved performance and a GPL license, but it’s not as popular as MySQL.

How to install

Assuming you’re using arch linux you can use the pacman package manager:

sudo pacman -S mariadb

Then run this command to complete the installation, you can change the datadir if you want:

mariadb-install-db --user=mysql --basedir=/usr –datadir=/var/lib/mysql

Now just start/enable the service:

sudo systemctl start mariadb

And log in as root (password is empty, just hit enter when asked):

sudo mariadb -u root -p

Now you can create an user and do other configurations, more details in the ArchWiki.

But if you’re just using the database in you local machine and you’re not going to deploy any application it’s easier to just use the root user without a password. To do that you may use this query in the database:

GRANT ALL PRIVILEGES on *.* to ‘root’@’localhost’ IDENTIFIED BY ‘<password>; FLUSH PRIVILEGES;

Replace <password> with the password that you want.

If you typed the password wrong you can change it after with this other query:

ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘<password>’;