Setting up a MariaDB database
Now, we will switch our database from H2 to MariaDB. The database tables are still created automatically by JPA. However, before we run our application, we have to create a database for it. In this section, we will be using the one-to-many relationship from the previous section.
The database can be created by using HeidiSQL. Open HeidiSQL and follow these steps:
- Right-click inside the database list.
- Then, select Create new | Database:
- Let's name our database
cardb
. After clicking OK, you should see the newcardb
database in the database list:
- In Spring Boot, add a MariaDB Java client dependency to the
pom.xml
file and remove the H2 dependency since we don't need it anymore:<dependency> <groupId>org.mariadb.jdbc</groupId> ...