Configure MariaDB

Last modified by Eleni Cojocariu on 2026/07/13 22:34

Content

Steps

Warning

WIP

To configure MariaDB as the database for XWiki:

  1. Download and install MariaDB following its official instructions. See the Database support strategy for supported versions.
  2. Download the MariaDB JDBC driver and copy it into the XWiki webapp's WEB-INF/lib directory.

    Download the MariaDB Connector/J, or get it from the Maven Central Repository. The JAR file is named mariadb-java-client-*.jar.

  3. Create the xwiki database user and the xwiki database. Use the mysql command-line client:
    • Log in as root:
      mysql -u root -p
    • Create the database with the required encoding:
      CREATE DATABASE xwiki CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
    • Create the xwiki user:
      CREATE USER 'xwiki'@'localhost' IDENTIFIED BY 'xwiki';
    • Replace 'xwiki' with a strong password for production environments.
    • Grant all privileges on the database:
      GRANT ALL PRIVILEGES ON xwiki.* TO 'xwiki'@'localhost';
      FLUSH PRIVILEGES;
    • Verify the database was created:
      SHOW DATABASES;
  4. Configure XWiki to use MariaDB. Open WEB-INF/hibernate.cfg.xml in your XWiki webapp and set the following properties:
    <property name="connection.url">jdbc:mariadb://localhost:3306/xwiki?useSSL=false</property>
    <property name="connection.username">xwiki</property>
    <property name="connection.password">xwiki</property>
    <property name="connection.driver_class">org.mariadb.jdbc.Driver</property>
    <property name="connection.useUnicode">true</property>
    <property name="connection.characterEncoding">UTF-8</property>
    Adjust the host, port, or database name if your setup differs. For production environments, configure SSL and use a strong password.

FAQ

Can I use a different database name or user?

Yes. Replace xwiki with your preferred names in the creation steps and in the connection.url property.

How do I remove the database if needed?

Log in as root and run:

DROP DATABASE xwiki;
DROP USER 'xwiki'@'localhost';

What database encoding and collation should I use?

XWiki expects the database to use UTF-8 encoding with a binary collation. It supports both utf8 and utf8mb4, but utf8mb4 with the utf8mb4_bin collation is strongly recommended.

Get Connected