Last Modified 2022.2.8

Install MariaDB on Ubuntu 18.04

sudo apt update
sudo apt install mariadb-server

If the installation is completed without errors, run the following command to set the root password. (Press the Enter key for the current password)

sudo mysql_secure_installation

Even if you set a password, mysql --user = root - password mysql will generate an error. Let's check the plugin that the root user uses.

sudo mysql
use mysql
select user,host,plugin from mysql.user;

Set the root user to use the mysql_native_password plugin.

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

Restart MariaDB.

sudo service mariadb restart

mysql --user=root --password mysql