Wiki source code of XWiki Cannot Connect to MySQL
Last modified by Eleni Cojocariu on 2026/11/25 14:48
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | XWiki does not start. The browser shows an initialization failure, ##Could not initialize main XWiki instance##, and the logs carry the reason: | ||
| 2 | |||
| 3 | {{code language="none"}} | ||
| 4 | Could not create a DBCP pool. There is an error in the Hibernate configuration file, please review it. | ||
| 5 | {{/code}} | ||
| 6 | |||
| 7 | === Cause === | ||
| 8 | |||
| 9 | XWiki could not open a connection to the MySQL server at all, so its connection pool was never created. Despite what the message says, the Hibernate configuration file is frequently correct: the pool reports itself as misconfigured as soon as its very first connection attempt fails, whatever the reason for that failure. | ||
| 10 | |||
| 11 | The usual reason is a MySQL server that is not listening where XWiki is looking. Either the server accepts no network connection at all, because ##skip-networking## is enabled, or it is bound to a single interface through ##bind-address## that does not include the address XWiki connects to. | ||
| 12 | |||
| 13 | === Solution === | ||
| 14 | |||
| 15 | 1. From the machine running XWiki, check whether the server answers at all. This is the same connection XWiki makes, without Hibernate in the way:((( | ||
| 16 | {{code language="none"}} | ||
| 17 | mysql -h <host> -u xwiki -p | ||
| 18 | {{/code}} | ||
| 19 | |||
| 20 | If this fails too, the fault is on the MySQL side and no amount of editing XWiki's configuration will fix it. | ||
| 21 | ))) | ||
| 22 | 1. Open the MySQL server's configuration file and remove or comment out ##skip-networking##, which stops the server from accepting any network connection. | ||
| 23 | 1. In the same file, set ##bind-address## to an address the XWiki host can reach. A server left on ##127.0.0.1## accepts connections from its own machine only, which is the usual surprise when XWiki runs on another host or in a container. | ||
| 24 | 1. Restart the MySQL server, then restart XWiki. The pool is created and the wiki is served. |