Changes for page MySQL Installation

Last modified by Thomas Mortagne on 2023/04/19

<
From version < 65.1 >
edited by Thomas Mortagne
on 2020/12/02
To version < 66.2 >
edited by Vincent Massol
on 2020/12/02
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ThomasMortagne
1 +XWiki.VincentMassol
Content
... ... @@ -18,9 +18,9 @@
18 18  
19 19  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 parts of the application work 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. MySQL 4 is pretty old and buggy so we recommend upgrading.
20 20  
21 -== MySQL versions older than 5.7 ==
21 +== MySQL versions older than 5.7 and utf8mb4 ==
22 22  
23 -Since XWiki moved to utf8mb4 by default it does not work with versions of MySQL lower than 5.7 out of the box because of a limitation in the default maximum size of the keys and the default row format.
23 +If you use utf8mb4 encoding you won't be able to use version of MySQL older than 5.7 out of the box because of a limitation in the default maximum size of the keys and the default row format.
24 24  
25 25  = Installation Steps =
26 26  
... ... @@ -31,22 +31,22 @@
31 31  * Create the wiki database. You can use the name you want for the database, but you will have to set the hibernate configuration file and ##xwiki.cfg## file accordingly.(((
32 32  You can create the database in several ways. For example use:
33 33  
34 -{{code}}
34 +{{code language='shell'}}
35 35  mysql -u root -e "create database xwiki default character set utf8mb4 collate utf8mb4_bin"
36 36  {{/code}}
37 37  )))
38 38  * Create the ##xwiki## user with password ##xwiki##(((
39 -{{code}}
39 +{{code language='shell'}}
40 40  mysql -u root -e "CREATE USER 'xwiki'@'localhost' IDENTIFIED BY 'xwiki'";
41 41  {{/code}}
42 42  )))
43 43  * Give privileges to the ##xwiki## user for accessing and creating databases (for the multi wiki support). Specifically the ##xwiki## users needs permissions to be able to execute {{code}}CREATE DATABASE{{/code}}, {{code}}DROP SCHEMA{{/code}}, and then all CRUD operations on tables. Note that the command below should be tuned to be more restrictive as granting all permissions is not required:(((
44 -{{code}}
44 +{{code language='shell'}}
45 45  mysql -u root -e "grant all privileges on *.* to xwiki@localhost"
46 46  {{/code}}
47 47  )))
48 48  * If the above command fails with a password-does-not-meet-requirements error, uninstall the MySQL password_validate plugin or pick a more complex password and update the password used by default in ##hibernate.cfg.xml##:(((
49 -{{code}}
49 +{{code language='shell'}}
50 50  mysql -u root -p -e "uninstall plugin validate_password;"
51 51  {{/code}}
52 52  )))
... ... @@ -77,7 +77,7 @@
77 77  
78 78  See [[Database Administration>>Documentation.AdminGuide.Performances.Database Administration.WebHome]].
79 79  
80 -{{code}}
80 +{{code language='mysql'}}
81 81  // Required
82 82  create index xwl_value on xwikilargestrings (xwl_value(50));
83 83  create index xwd_parent on xwikidoc (xwd_parent(50));
... ... @@ -104,7 +104,7 @@
104 104  {{info}}
105 105  Note to XWiki developers: The following indexes could be created automatically though since they're less than 255 characters and thus should be added in a future version of XWiki so that they don't need to be created manually:
106 106  
107 -{{code}}
107 +{{code language='mysql'}}
108 108  create index xws_number on xwikistatsdoc (XWS_NUMBER);
109 109  create index xws_classname on xwikistatsdoc (XWS_CLASSNAME);
110 110  create index xwr_number on xwikistatsreferer (XWR_NUMBER);
... ... @@ -135,7 +135,7 @@
135 135  
136 136  == Convert a database from latin1 (or collation utf8_ci) to utf8mb4/utf8mb4_bin ==
137 137  
138 -{{code}}
138 +{{code language='shell'}}
139 139  #!/bin/bash
140 140  
141 141  db=xwiki
... ... @@ -161,7 +161,7 @@
161 161  
162 162  == Convert from MyISAM to InnoDB ==
163 163  
164 -{{code}}
164 +{{code language='shell'}}
165 165  #!/bin/bash
166 166  
167 167  MYSQL_COMMAND=mysql
... ... @@ -197,7 +197,7 @@
197 197  
198 198  == Unable to login to MySQL Console ==
199 199  
200 -When running {{code}}mysql -u root -e "create database xwiki default character set utf8mb4{{/code}} you may get a {{code}}ERROR 1045 (28000): Access denied for user 'xwiki'@'localhost' (using password: YES){{/code}} error.
200 +When running {{code language='shell'}}mysql -u root -e "create database xwiki default character set utf8mb4{{/code}} you may get a {{code}}ERROR 1045 (28000): Access denied for user 'xwiki'@'localhost' (using password: YES){{/code}} error.
201 201  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.
202 202  
203 203  == Can't create test file ==
... ... @@ -204,7 +204,7 @@
204 204  
205 205  When running ##mysqld ~-~-console## you may get the following (especially if you're on a Mac):
206 206  
207 -{{code}}
207 +{{code language='none'}}
208 208  071111 17:20:53 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-i686/data/Vincent.lower-test
209 209  071111 17:20:53 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-i686/data/Vincent.lower-test
210 210  mysqld: Can't change dir to '/usr/local/mysql-5.0.45-osx10.4-i686/data/' (Errcode: 13)
... ... @@ -221,7 +221,7 @@
221 221  
222 222  If you receive an Exception like the following while installing/upgrading XWiki, chances are that you are using an outdated version of MySQLConnectorJ.
223 223  
224 -{{code}}
224 +{{code language='none'}}
225 225  Caused by: java.sql.BatchUpdateException: Data truncation: Out of
226 226  range value adjusted for column 'XWD_HIDDEN' at row 1
227 227   at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:894)
... ... @@ -237,7 +237,7 @@
237 237  
238 238  == HTTP 500 Error ==
239 239  
240 -{{code}}
240 +{{code language='none'}}
241 241  HTTP Status 500 -
242 242  
243 243  type Exception report
... ... @@ -267,7 +267,7 @@
267 267  
268 268  If you get the following error:
269 269  
270 -{{code language="none"}}
270 +{{code language='none'}}
271 271  Caused by: class com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'xwiki'
272 272   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
273 273   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
... ... @@ -300,7 +300,7 @@
300 300  
301 301  It means that XWiki could connect to your database but there's no ##xwiki## schema available there. This is the default name of the schema XWiki is looking for, for the main wiki database.
302 302  
303 -It probably means you've created a database named other than ##xwiki## (for example you might have created a database named ##abcd## and set the following connection URL in your ##hibernate.cfg## file: {{code language="none"}}<property name="connection.url">jdbc:mysql://localhost/abcd</property>{{/code}}).
303 +It probably means you've created a database named other than ##xwiki## (for example you might have created a database named ##abcd## and set the following connection URL in your ##hibernate.cfg## file: {{code language='none'}}<property name="connection.url">jdbc:mysql://localhost/abcd</property>{{/code}}).
304 304  
305 305  If this is the case [[you need to tell XWiki that you're using a different schema by setting the ##xwiki.db## configuration property>>platform:AdminGuide.Configuration#HConfigurethenamesofdatabaseschemas]].
306 306  
... ... @@ -308,7 +308,7 @@
308 308  
309 309  if you get the following error:
310 310  
311 -{{code language="none"}}
311 +{{code language='none'}}
312 312  MySQLSyntaxErrorException: Row size too large (> 8126).
313 313  Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.
314 314  In current row format, BLOB prefix of 768 bytes is stored inline.

Get Connected