MariaDB and Spring Boot

Yaml Configuration

spring:
    datasource:
        url: jdbc:mysql://127.0.0.1:3306/yourDbName
        username: root
        password: root
        driver-class-name: org.mariadb.jdbc.Driver
    jpa:
        properties:
            hibernate:
                dialect: org.hibernate.dialect.MySQL5InnoDBDialect

Important to notice

  • hibernate.dialect must be set
  • driver-class-name must be set
  • it needs to be the MySQL5InnoDBDialect or MySQL57InnoDBDialect instead of the MySQLInnoDBDialect

Dependencies in Maven

<dependency>
    <groupId>org.mariadb.jdbc</groupId>
    <artifactId>mariadb-java-client</artifactId>
    <version>1.1.9</version>
</dependency>

<!-- if not already present -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

Paul Sterl has written 54 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>