Last Modified 8.2.2023

Install MariaDB on Ubuntu

sudo apt update
sudo apt install mariadb-server

If the installation is completed without errors, run the security script to restrict access to the server.

sudo mysql_secure_installation

Refer to the following to complete the security settings.

Enter current password for root (enter for none): <just press ENTER>

Switch to unix_socket authentication [Y/n] n

Change the root password? [Y/n] n

Just press ENTER for all of the following prompt questions to select the default Y.

Remove anonymous users? [Y/n]  

Disallow root login remotely? [Y/n] 

Remove test database and access to it? [Y/n] 

Reload privilege tables now? [Y/n] 

How to connect MariaDB server:

sudo mysql
use mysql
show tables;

Note: you cannot connect with mysql --user=root --password mysql command.

You can use the MySQL JDBC driver as it is.

<!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j -->
<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
    <version>8.1.0</version>
</dependency>
References