Configure MariaDB
Last modified by Eleni Cojocariu on 2026/07/13 22:34
Steps
To configure MariaDB as the database for XWiki:
- Download and install MariaDB following its official instructions. See the Database support strategy for supported versions.
- 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.
- 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;
- Log in as root:
- Configure XWiki to use MariaDB. Open WEB-INF/hibernate.cfg.xml in your XWiki webapp and set the following properties:Adjust the host, port, or database name if your setup differs. For production environments, configure SSL and use a strong password.
<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>
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.