Changes for page MySQL Installation

Last modified by Thomas Mortagne on 2023/04/19

<
From version < 6.2 >
edited by Vincent Massol
on 2010/03/05
To version < 7.1 >
edited by Vincent Massol
on 2010/03/05
>
Change comment: Document converted from syntax xwiki/1.0 to syntax xwiki/2.0

Summary

Details

Page properties
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 1.0
1 +XWiki 2.0
Content
... ... @@ -1,62 +1,70 @@
1 -#toc("" "" "")
1 +{{toc start="" depth="" numbered=""/}}
2 2  
3 -1 Installation Steps
3 += Installation Steps =
4 4  
5 5  Follow these instructions:
6 6  
7 -* Download and install [MySQL>http://www.mysql.com/] 5.X or greater #warning("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 easily be 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.")
7 +* Download and install [[MySQL>>http://www.mysql.com/]] 5.X or greater {{warning}}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 easily be 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.{{/warning}}
8 8  * Start the MySQL server. You can do that in several ways. For example:
9 -{code:none}
9 +
10 +{{code language="none"}}
10 10  mysqld --console
11 -{code}
12 +{{/code}}
13 +
12 12  * Create the wiki database. You can do that in several ways. For example:
13 -{code:none}
15 +
16 +{{code language="none"}}
14 14  mysql -u root -e "create database xwiki"
15 -{code}
18 +{{/code}}
19 +
16 16  * Give all privileges to the xwiki user for accessing the xwiki database. You can do that in several ways. For example (if you get connections problems try localhost instead of the IP address below):
17 -{code:none}
21 +
22 +{{code language="none"}}
18 18  mysql -u root -e "grant all privileges on xwiki.* to xwiki@localhost identified by 'xwiki'"
19 -{code}
24 +{{/code}}
25 +
20 20  * Please make sure that the DNS-name "localhost" is defined in your hosts-file (i.e. /etc/hosts)
21 -* You need to have the MySQL JDBC Driver JAR (named <tt>mysql-connector-java*.jar</tt> installed in XWiki's WAR file. If this file isn't present in XWiki's <tt>WEB-INF/lib</tt> directory you'll need to download it and copy it there. You can download it from the [MySQL Connector/J Driver page>http://www.mysql.com/products/connector/j/] or directly from the [Maven Central Repository>http://repo1.maven.org/maven2/mysql/mysql-connector-java/].
22 -* Now you need to tell XWiki to use MySQL. To do this, edit the <tt>WEB-INF/hibernate.cfg.xml</tt> file where you have expanded the XWiki WAR file and replace the matching properties with the following ones:
23 -{code:xml}
27 +* 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>>http://www.mysql.com/products/connector/j/]] or directly from the [[Maven Central Repository>>http://repo1.maven.org/maven2/mysql/mysql-connector-java/]].
28 +* 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:
29 +
30 +{{code language="xml"}}
24 24  <property name="connection.url">jdbc:mysql://localhost/xwiki</property>
25 25  <property name="connection.username">xwiki</property>
26 26  <property name="connection.password">xwiki</property>
27 27  <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
28 28  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
29 -{code}
36 +{{/code}}
30 30  
31 -Note: By default MySQL only accepts packets smaller than 1MB. If you get the "Packet for query is too large (max_allowed_packet)" error then see the [Packet too large error page>http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html]. For example to increase the packet size to 32M you could start the MySQL server with:
32 -{code:none}
38 +Note: By default MySQL only accepts packets smaller than 1MB. If you get the "Packet for query is too large (max_allowed_packet)" error then see the [[Packet too large error page>>http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html]]. For example to increase the packet size to 32M you could start the MySQL server with:
39 +
40 +{{code language="none"}}
33 33  mysqld --console --max_allowed_packet=32M
34 -{code}
42 +{{/code}}
35 35  
36 -1 Troubleshooting
44 += Troubleshooting =
37 37  
38 -1.1 Can't create test file
46 +== Can't create test file ==
39 39  
40 -When running <tt>mysqld --console</tt> you may get the following (especially if you're on Mac):
48 +When running ##mysqld ~-~-console## you may get the following (especially if you're on Mac):
41 41  
42 -{code:none}
50 +{{code language="none"}}
43 43  071111 17:20:53 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-i686/data/Vincent.lower-test
44 44  071111 17:20:53 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-i686/data/Vincent.lower-test
45 45  mysqld: Can't change dir to '/usr/local/mysql-5.0.45-osx10.4-i686/data/' (Errcode: 13)
46 46  071111 17:20:53 [ERROR] Aborting
47 -{code}
55 +{{/code}}
48 48  
49 49  To start MySQL run the following instead:
50 50  
51 -{code}
59 +{{code}}
52 52  sudo /usr/local/mysql/bin/mysqld_safe --user=mysql
53 -{code}
61 +{{/code}}
54 54  
55 -1.1 Data Truncation Error
63 +== Data Truncation Error ==
56 56  
57 57  If you receive an Exception like the following while installing / upgrading XWiki:
58 58  
59 -{code:none}
67 +{{code language="none"}}
60 60  Caused by: java.sql.BatchUpdateException: Data truncation: Out of
61 61  range value adjusted for column 'XWD_HIDDEN' at row 1
62 62   at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:894)
... ... @@ -64,11 +64,10 @@
64 64   at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
65 65   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
66 66   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
67 -{code}
75 +{{/code}}
68 68  
69 69  chances are, that you are using an outdated version of MySQLConnectorJ.
70 70  
71 -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.
79 +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.
72 72  
73 73  Upgrade to the latest version of MySQLConnectorJ should solve such an error in most of the cases.
74 -
XWiki.XWikiComments[0]
Comment
... ... @@ -1,5 +1,1 @@
1 -Specifying Packet size when running MYSQL as service:
2 -For windows invoke services utility which lists all the service configured on your window platform.Go to MySQL service configuration. On "General Tab" we can find the file used by the MySQL service to load the parameters. For eg. in my case it is
3 -"d:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt" --defaults-file="d:\Program Files\MySQL\MySQL Server 5.0\my.ini".
4 -Add following line to configure size to 64M.
5 -max_allowed_packet=64M
1 +Specifying Packet size when running MYSQL as service: For windows invoke services utility which lists all the service configured on your window platform.Go to MySQL service configuration. On "General Tab" we can find the file used by the MySQL service to load the parameters. For eg. in my case it is "d:Program FilesMySQLMySQL Server 5.0binmysqld-nt" ~-~-defaults-file="d:Program FilesMySQLMySQL Server 5.0my.ini". Add following line to configure size to 64M. max_allowed_packet=64M
XWiki.XWikiComments[1]
Comment
... ... @@ -1,1 +1,1 @@
1 -I use the MySQL Administrator tool *almost* exclusively with MySQL tasks. It used to be a pain to work with (for example, disabled fields when they were not in the ini), but as at recent revisions (r8 in particular), this is no longer a problem.
1 +I use the MySQL Administrator tool **almost** exclusively with MySQL tasks. It used to be a pain to work with (for example, disabled fields when they were not in the ini), but as at recent revisions (r8 in particular), this is no longer a problem.
XWiki.XWikiComments[6]
Comment
... ... @@ -1,1 +1,1 @@
1 -Discovered (painfully) during installation of xwiki-enterprise-web-1.9.3.war in Apache Tomcat 5.5.23 using MySQL 5.0.45 that success required using the MySQL connector from Maven mysql-connector-java-5.1.6.jar (rather than from the MySQL Connector/J Driver page) and connection.url jdbc:mysql://127.0.0.1/xwiki (rather than jdbc:mysql://localhost/xwiki).
1 +Discovered (painfully) during installation of xwiki-enterprise-web-1.9.3.war in Apache Tomcat 5.5.23 using MySQL 5.0.45 that success required using the MySQL connector from Maven mysql-connector-java-5.1.6.jar (rather than from the MySQL Connector/J Driver page) and connection.url jdbc:mysql:~/~/127.0.0.1/xwiki (rather than jdbc:mysql:~/~/localhost/xwiki).

Get Connected