Wiki source code of "Unknown database" MySQL Error

Last modified by Eleni Cojocariu on 2026/11/25 14:48

Show last authors
1 XWiki starts, fails to open its database, and the logs carry a JDBC exception whose message is:
2
3 {{code language="none"}}
4 Unknown database 'xwiki'
5 {{/code}}
6
7 === Cause ===
8
9 XWiki reached the MySQL server, had the host, port, user or password been wrong, the failure would have come before this one, but that server holds no schema under the name the connection URL asks for. ##xwiki## is the name XWiki looks for by default, so the mismatch takes one of two shapes: a database created under a different name while the configuration still asks for ##xwiki##, or a configuration naming a database that was never created, such as ##[[jdbc:mysql://localhost/abcd#]]#.##
10
11 === Solution ===
12
13 1. Connect to the MySQL server and list what it actually holds:(((
14 {{code language="sql"}}
15 SHOW DATABASES;
16 {{/code}}
17 )))
18 1. Compare that list with the database named at the end of ##hibernate.connection.url## in the ##WEB-INF/hibernate.cfg.xml## file. Either the database or the configuration has to change.
19 1. If the database is simply missing, create it with the character set and collation XWiki expects, the create-database step of [[Configure MySQL>>doc:documentation.xs.admin.installation.database.configure-mysql.WebHome]] gives the statement.
20 1. If the database exists under another name, point XWiki at that name instead: put it at the end of ##hibernate.connection.url##, and, when the main wiki's database is not called ##xwiki##, also set the ##xwiki.db## property in the ##WEB-INF/xwiki.cfg## file, as the create-database step of [[Configure MySQL>>doc:documentation.xs.admin.installation.database.configure-mysql.WebHome]] describes.
21 1. Restart XWiki. It connects to the database the configuration names and creates its tables there.

Get Connected