> Markdown version of [MariaDB](https://vaadin.com/docs/v23/integrations/databases/mariadb). Section index: [llms.txt](https://vaadin.com/docs/v23/integrations/llms.txt)

# Connecting to MariaDB

MariaDB is a popular fork of the relational database MySQL. You need to [install MariaDB](https://mariadb.org/download/?t=mariadb\&o=true\&p=mariadb\&r=10.10.0) separately before you can connect to it from your Vaadin application (you can also install MariaDB as a [Docker container](https://hub.docker.com/_/mariadb)).

For an existing Vaadin project, you can connect to MariaDB by following these steps:

1. Add the `mariadb-java-client` dependency to the `pom.xml` file.

   `pom.xml`

   ```xml
   <dependency>
       <groupId>org.mariadb.jdbc</groupId>
       <artifactId>mariadb-java-client</artifactId>
       <version>3.0.5</version>
   </dependency>
   ```

2. Add MariaDB configuration properties to the `src/main/resources/application.properties` file. You have to replace `HOST`, `PORT`, `DB_NAME`, `USERNAME`, `PASSWORD` with corresponding parameters from your MariaDB instance.

   `application.properties`

   ```properties
   # MariaDB Configuration
   spring.jpa.hibernate.ddl-auto=update
   spring.datasource.url=jdbc:mariadb://HOST:PORT/DB_NAME
   spring.datasource.username=USERNAME
   spring.datasource.password=PASSWORD
   spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
   ```

> **Caution: Avoid storing sensitive information in the project’s properties file.**
>
> It’s bad practice to store database URI, username, and passwords in the `application.properties` file. You should consider [externalizing](https://vaadin.com/docs/v23/security/advanced-topics/external-configuration.md) these properties.

`343BF5D5-D993-4273-BD94-D32DE5814898`
