Compatibility Considerations
MyISAM storage engine
MyISAM (the default storage engine for MySQL) does not support transactions. If there is an error while data is being saved to the database, XWiki will attempt to rollback the transaction to its previous known good state. If you use MyISAM it will do nothing, leaving the database in whatever state it was in when the error occurred.
MySQL versions older than 5.0
XWiki does not fully work with MySQL versions 4.x or lower, due to several limitations of the way the SQL standards are implemented in MySQL, limited support for non-latin1 encodings, the flaky integration of Hibernate and MySQL 4, and other things. Most of the application works fine, but there are some parts that cannot be easily fixed, so if you must use MySQL 4.x, you're doing it on your own. Seriously, MySQL 4 is pretty old and buggy, you should consider upgrading.
Installation Steps
Follow these instructions:
- Download and install MySQL 5.X or greater.
- Start the MySQL server. You can do that in several ways. For example:mysqld --console
- Create the wiki database. You can use the name you want for the database, but you will have to set hibernate configuration file and xwiki.cfg file accordingly. You can create the database in several ways. For example:mysql -u root -e "create database xwiki default character set utf8"
- Give all privileges to the xwiki user for accessing the xwiki database. You can do that in several ways. For example (if you get connection problems try localhost instead of the IP address below):mysql -u root -e "grant all privileges on xwiki.* to xwiki@localhost identified by 'xwiki'"mysql -u root -e "grant all privileges on workspacetemplate.* to xwiki@localhost identified by 'xwiki'"
- Please make sure that the DNS-name "localhost" is defined in your hosts-file (i.e. /etc/hosts)
- You need to have the MySQL JDBC Driver JAR (named mysql-connector-java*.jar) installed in XWiki's WAR file. If this file isn't present in XWiki's WEB-INF/lib directory you'll need to download it and copy it there. You can download it from the MySQL Connector/J Driver page or directly from the Maven Central Repository.
- Now you need to tell XWiki to use MySQL. To do this, edit the WEB-INF/hibernate.cfg.xml file where you have expanded the XWiki WAR file and replace the matching properties with the following ones (you can also comment out the HSQLDB part and uncomment the MySQL one):<property name="connection.url">jdbc:mysql://localhost/xwiki</property>
<property name="connection.username">xwiki</property>
<property name="connection.password">xwiki</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
Troubleshooting
Unable to login to MySQL Console
When running
you may get a
This means that you have a password set for the MySQL root user, but you are not specifying it in the console command. You must also use the -p parameter. Using this you will be prompted to enter the password and be allowed to login to the MySQL console and create the database.
Can't create test file
When running mysqld --console you may get the following (especially if you're on a Mac):
071111 17:20:53 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-i686/data/Vincent.lower-test
mysqld: Can't change dir to '/usr/local/mysql-5.0.45-osx10.4-i686/data/' (Errcode: 13)
071111 17:20:53 [ERROR] Aborting
To start MySQL run the following instead:
Data Truncation Error
If you receive an Exception like the following while installing/upgrading XWiki, chances are that you are using an outdated version of MySQLConnectorJ.
range value adjusted for column 'XWD_HIDDEN' at row 1
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:894)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
On Linux, mysql-connector-java-3.x has proven not to work due to a bug in the handling of UTF-8 and lack of support for Boolean types.
Upgrading to the latest version of MySQLConnectorJ should solve such an error in most of the cases.
HTTP 500 Error
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: com.xpn.xwiki.XWikiException: Error number 3 in 0: Could not initialize main XWiki context
Wrapped Exception: Error number 3001 in 3: Cannot load class com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager from param xwiki.store.migration.manager.class
Wrapped Exception: Error number 0 in 3: Exception while hibernate execute
Wrapped Exception: Could not create a DBCP pool. There is an error in the hibernate configuration file, please review it.
root cause
com.xpn.xwiki.XWikiException: Error number 3 in 0: Could not initialize main XWiki context
Wrapped Exception: Error number 3001 in 3: Cannot load class com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager from param xwiki.store.migration.manager.class
Wrapped Exception: Error number 0 in 3: Exception while hibernate execute
Wrapped Exception: Could not create a DBCP pool. There is an error in the hibernate configuration file, please review it.
In this case, try to disable skip-networking in MySQL *.ini file. Thanks a lot M Rawash for saved time (see his comment below).