Published
Convert the MySQL Installation documentation into the documentation tree
Conversion of MySQL Installation into the documentation tree, following the Documentation Guide. The legacy page was treated as source material: every one of its 89 pieces of content was inventoried, checked against the platform sources and a running XWiki 18.6.0, and then either placed on one of the new pages (65 of them) or dropped as obsolete (24).
The new subtree takes the shape configure-oracle-manually already sets, under install-relational-database:
- configure-mysql (How-to) with the install steps, and below it
- storage-engine-character-set (Explanation) for why InnoDB and the utf8mb4_bin pair are required,
- optional-indexes (Reference) for the indexes XWiki does not create itself,
- convert-database-utf8mb4 and convert-myisam-tables-innodb (How-tos) for repairing a database that was created wrong,
- five error pages, one per failure the legacy Troubleshooting section covered: server-unreachable, unknown-database, server-timezone-unrecognized, max-allowed-packet and row-size-limit.
configure-mariadb is edited rather than created. It existed already and said that MySQL and MariaDB are configured the same way, which is what let it stay short; it now carries only the differences. Three things it stated turned out to be wrong against the sources:
- it granted privileges ON xwiki.*, but a farm needs ON *.*: each subwiki is a database of its own, and creating one needs the right. The functional tests run MariaDB through the same startMySQLContainer as MySQL and grant on *.* for exactly that reason.
- it called utf8mb4 "strongly recommended". It is required, like everywhere else in this tree.
- it told the reader to run mysql. Since MariaDB 11.0 that name is gone from the MariaDB images and the client is mariadb.
The shipped hibernate.cfg.xml template's MariaDB block differs from its MySQL block in exactly two values, the connection URL and the driver class, so those two are what the page shows.
The biggest correction is a step that must not be published at all. The legacy page asked the reader to run four ALTER TABLE ... LONGTEXT statements by hand. Those exact tables and columns are migrated automatically by R130200000XWIKI17200DataMigration, and have been since 12.10.6 / 13.2, so the statements are gone rather than carried over.
Dropped as obsolete, each because a supported version no longer behaves that way: the "MySQL versions older than 5.0" and "older than 5.7 and utf8mb4" sections, the "Incorrect string value" section (the connector window it describes exists only in the dead mysql-connector-java artifact, and the JIRA issue it cites is closed as Won't Fix and narrower than the page claimed), "Can't create test file" (a 2007 transcript of MySQL 5.0.45 on OS X 10.4, embedding a developer's hostname), the Data Truncation section (pre-cj driver and DBCP 1) and the two MySQL 8 tips (mysql_native_password is unnecessary with the com.mysql.cj driver, and the driver-class tip prescribes what the shipped configuration already contains). The -Dfile.encoding advice buried in the dropped connector section survives, on storage-engine-character-set.
There is one screenshot, on the root How-to's result step. The rest of the material is mysql shell commands and hibernate.cfg.xml snippets, which the pages show as code examples; the sibling database pages in this tree carry no screenshots either.
The legacy page is stripped, not deleted, the way its converted InstallationOracle sibling already is: 15 of its 19 headings are kept verbatim, each pointing at the page that now carries it, so the anchors saved in old bookmarks and forum posts still resolve. Two of them are load-bearing: HTroubleshooting is linked from the Debian/Ubuntu installation page and HIndexes from Database Administration. The four dropped anchors are exactly the four obsolete sections above. The page has no attachments to delete.
Its backlinks are triaged in this change request as well: the tree's own hub, hsqldb-limitations and backup.database-commands in the new tree, and the legacy InstallationWAR, InstallationViaAPT, InstallationMariaDB and Database Administration pages. The Database Administration link is the one that asked for the indexes section, so it now points at optional-indexes rather than at the root. The release note for 12.5 is deliberately left alone, since a release note records what was true then, and configure-mariadb's link disappears with the trim above.
Two things could not go into this change request, and are noted here so they are not mistaken for oversights:
- The Extensions-wiki backlink, in the installation field of Extension.XWikiHelm. A change request cannot span two wikis, so that one is applied separately on extensions.xwiki.org, pointing at convert-database-utf8mb4, which is the conversion its sentence asks for.
- The parent's navigation pin. install-relational-database.WebPreferences pins its eight children and also carries an XWiki.XWikiPreferences xobject, which makes the change request application refuse a file change on it. Without that one value, configure-mysql sorts after every pinned sibling and lands at the bottom of the database list instead of next to MariaDB. Could someone with rights on that page set pinnedChildPages to:
configure-hsqldb/|configure-mariadb/|configure-mysql/|configure-postgresql-manually/|configure-postgresql-docker/|configure-oracle-manually/|configure-oracle-docker/|configure-oracle-vm/|use-container-managed-data-source/The pin for the new subtree's own nine children is in this change request, as a configure-mysql.WebPreferences file change: it puts the Explanation the hub introduces first at the top and the five error pages last, which is the order the hub's own prose and FAQ use, rather than the alphabetical-by-title order the tree would otherwise show.
-
Eleni Cojocariu created this Change Request with changes for Configure MySQL
1 month ago
-
Eleni Cojocariu added a new change for Configure MariaDB
1 month ago
-
Eleni Cojocariu added a new change for Convert a MySQL Database to utf8mb4
1 month ago
-
Eleni Cojocariu added a new change for Convert MyISAM Tables to InnoDB
1 month ago
-
Eleni Cojocariu added a new change for "Packet for query is too large" MySQL Error
1 month ago
-
Eleni Cojocariu added a new change for Optional MySQL Indexes
1 month ago
-
Eleni Cojocariu added a new change for "Row size too large" MySQL Error
1 month ago
-
Eleni Cojocariu added a new change for "The server timezone value is unrecognized" MySQL Error
1 month ago
-
Eleni Cojocariu added a new change for XWiki Cannot Connect to MySQL
1 month ago
-
Eleni Cojocariu added a new change for MySQL Storage Engine and Character Set
1 month ago
-
Eleni Cojocariu added a new change for "Unknown database" MySQL Error
1 month ago
-
Eleni Cojocariu added a new change for MySQL Installation
1 month ago
-
Eleni Cojocariu added a new change for Install and Configure a Relational Database
1 month ago
-
Eleni Cojocariu added a new change for HSQLDB Limitations
1 month ago
-
Eleni Cojocariu added a new change for Database Backup and Restore Commands
1 month ago
-
Eleni Cojocariu added a new change for Installing XWiki .war package manually
1 month ago
-
Eleni Cojocariu added a new change for Installation using Debian/Ubuntu (.DEB) packages
1 month ago
-
Eleni Cojocariu added a new change for MariaDB Installation
1 month ago
-
Eleni Cojocariu added a new change for Database Administration
1 month ago
-
Eleni Cojocariu added a new change for Page Administration
1 month ago
-
Eleni Cojocariu added a new change for MariaDB Installation
1 month ago
-
Eleni Cojocariu added a new change for Installing XWiki .war package manually
1 month ago
-
Eleni Cojocariu added a new change for Installation using Debian/Ubuntu (.DEB) packages
1 month ago
-
Eleni Cojocariu added a new change for Database Administration
1 month ago
-
Eleni Cojocariu added a new change for HSQLDB Limitations
1 month ago
-
Eleni Cojocariu added a new change for Install and Configure a Relational Database
1 month ago
-
Eleni Cojocariu added a new change for Database Backup and Restore Commands
1 month ago
-
Eleni Cojocariu added a new change for Configure MySQL
1 month ago
-
Eleni Cojocariu added a new change for Convert MyISAM Tables to InnoDB
1 month ago
-
Eleni Cojocariu added a new change for "Row size too large" MySQL Error
1 month ago
-
Eleni Cojocariu added a new change for "Packet for query is too large" MySQL Error
1 month ago
-
Eleni Cojocariu added a new change for "Row size too large" MySQL Error
1 month ago
-
Eleni Cojocariu added a new document comment
1 month ago
-
Eleni Cojocariu added a new change for "Unknown database" MySQL Error
1 month ago
-
Eleni Cojocariu added a new change for MySQL Storage Engine and Character Set
1 month ago
-
Eleni Cojocariu added a new change for "The server timezone value is unrecognized" MySQL Error
1 month ago
-
Eleni Cojocariu added a new approval review
1 month ago
-
Eleni Cojocariu changed the status of the Change Request from ready for review
to ready for publication
1 month ago
-
Eleni Cojocariu changed the status of the Change Request from ready for publication
to published
1 month ago
All changes
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Attachments (0 modified, 1 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +Configure MySQL - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,45 @@ 1 +o use [[MySQL>>https://www.mysql.com/]] as XWiki's database, the database has to use the InnoDB storage engine and a UTF-8 character set with a binary collation, for the reasons given in [[MySQL Storage Engine and Character Set>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]]. 2 + 3 +1. Make sure you have already installed and [[configured a servlet container>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.WebHome]] for XWiki (e.g. [[Tomcat>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.configure-tomcat.WebHome]] or [[Jetty>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.configure-jetty.WebHome]]), with the [[XWiki WAR>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.WebHome]] file extracted/deployed. 4 +1. Install [[MySQL>>https://dev.mysql.com/downloads/]] using whatever method suits your platform: a distribution package, MySQL's own installer, or a container image. See the [[Database support strategy>>dev:Community.SupportStrategy.DatabaseSupportStrategy]] for the supported versions. 5 +1. Download the MySQL JDBC driver and copy it into the XWiki webapp's ##WEB-INF/lib## directory.((( 6 +Get it from the [[MySQL Connector/J page>>https://www.mysql.com/downloads/connector/j/]] or from [[Maven Central>>https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/]], and use the latest version. The JAR file is named ##mysql-connector-j-*.jar##, from the {{code language="none"}}com.mysql:mysql-connector-j{{/code}} artifact. 7 +))) 8 +1. Create the ##xwiki## database with the required encoding. Log in as root with {{code language="none"}}mysql -u root -p{{/code}}, then run:((( 9 +{{code language="none"}} 10 +CREATE DATABASE xwiki CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; 11 +{{/code}} 12 + 13 +The database may have another name, but that name must then also be set as the ##xwiki.db## property in the ##WEB-INF/xwiki.cfg## file, as described in [[the names of the database schemas>>Documentation.AdminGuide.Configuration.WebHome||anchor="HConfigurethenamesofdatabaseschemas"]]. 14 +))) 15 +1. Create the ##xwiki## database user:((( 16 +{{code language="none"}} 17 +CREATE USER 'xwiki'@'localhost' IDENTIFIED BY 'xwiki'; 18 +{{/code}} 19 + 20 +Outside an evaluation setup, replace ##'xwiki'## with a strong password. 21 +))) 22 +1. Grant that user privileges on every database:((( 23 +{{code language="none"}} 24 +GRANT ALL PRIVILEGES ON *.* TO 'xwiki'@'localhost'; 25 +FLUSH PRIVILEGES; 26 +{{/code}} 27 +))) 28 +1. Configure XWiki to use MySQL. Open ##WEB-INF/hibernate.cfg.xml##, uncomment the MySQL configuration block, comment out the other database configurations, and set the connection values:((( 29 +{{code language="xml"}} 30 + <property name="hibernate.connection.url">jdbc:mysql://localhost/xwiki?useSSL=false</property> 31 + <property name="hibernate.connection.username">xwiki</property> 32 + <property name="hibernate.connection.password">xwiki</property> 33 + <property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property> 34 + <property name="hibernate.dbcp.poolPreparedStatements">true</property> 35 + <property name="hibernate.dbcp.maxOpenPreparedStatements">20</property> 36 + 37 + <property name="hibernate.connection.charSet">UTF-8</property> 38 + <property name="hibernate.connection.useUnicode">true</property> 39 + <property name="hibernate.connection.characterEncoding">utf8</property> 40 +{{/code}} 41 + 42 +Adjust the host, port or database name if your setup differs, and configure SSL for a production environment. 43 +))) 44 +1. Restart XWiki to apply the changes. 45 +1. Open your wiki in a browser. XWiki connects to MySQL, creates its tables on the first start, and serves the wiki without a database error.
- configure-mysql-first-start.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.elenicojocariu - Size
-
... ... @@ -1,0 +1,1 @@ 1 +167.7 KB - Content
- DocApp.Code.DocumentationClass[0]
-
- FAQ
-
... ... @@ -1,0 +1,15 @@ 1 +== Why is my "mysql -u root" connection refused? == 2 + 3 +Because a password is set for the MySQL root user and none was supplied, which MySQL reports as {{code language="none"}}ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO){{/code}}. Add the ##-p## parameter, which prompts for the password. 4 + 5 +== Do I need the hibernate.connection.driver_class property? == 6 + 7 +No. A MySQL 8+ JDBC driver registers itself, so the property is not needed and only produces a warning, as the comment in the shipped ##hibernate.cfg.xml## says. 8 + 9 +== Can the xwiki user be granted less than all privileges? == 10 + 11 +Yes, as long as it keeps ##CREATE DATABASE##, ##DROP SCHEMA## and full read/write rights on its own tables: XWiki gives every subwiki a database of its own, and creating one is what needs those rights. 12 + 13 +== XWiki does not start on MySQL. Where do I look? == 14 + 15 +The log names the failure, and each of the usual ones has its own page: [[an unreachable server>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.server-unreachable.WebHome]], [[an unknown database>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.unknown-database.WebHome]], [[an unrecognized server time zone>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.server-timezone-unrecognized.WebHome]], [[a query that is too large>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.max-allowed-packet.WebHome]] and [[a row that is too large>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.row-size-limit.WebHome]]. - Highlights
-
... ... @@ -1,0 +1,8 @@ 1 +* [[MySQL Storage Engine and Character Set>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]] 2 +** Why XWiki requires InnoDB and the ##utf8mb4_bin## pair, and what breaks without them. 3 +* [[Convert a MySQL Database to utf8mb4>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-database-utf8mb4.WebHome]] 4 +** Move a database created with the wrong character set onto the one XWiki expects. 5 +* [[Convert MyISAM Tables to InnoDB>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-myisam-tables-innodb.WebHome]] 6 +** Put a database inherited from an old installation back on a transactional engine. 7 +* [[Optional MySQL Indexes>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.optional-indexes.WebHome]] 8 +** The indexes XWiki does not create, and the queries each of them serves. - Related
-
... ... @@ -1,0 +1,4 @@ 1 +* [[Install and Configure a Relational Database>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.WebHome]]. 2 +* [[Configure MariaDB>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mariadb.WebHome]]. 3 +* [[Database Administration>>Documentation.AdminGuide.Performances.Database Administration.WebHome]]. 4 +* [[Database Support Strategy>>dev:Community.SupportStrategy.DatabaseSupportStrategy]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +howto
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. EleniCojocariu1 +XWiki.elenicojocariu - Content
-
... ... @@ -1,54 +1,15 @@ 1 -[[MariaDB>>https://mariadb.org/]] is a dro p-in replacementfor[[MySQL>>Documentation.AdminGuide.Installation.InstallationWAR.InstallationMySQL.WebHome]]andisconfiguredthesameway,with afewdifferences.To configureMariaDB asthedatabaseforXWiki:1 +XWiki treats [[MariaDB>>https://mariadb.org/]] exactly as it treats MySQL: the same store, the same database and user, and the same [[storage-engine and character-set requirements>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]]. Only the client command, the JDBC driver and two connection properties differ. 2 2 3 -1. Make sure you have already installedand[[configureda servlet container>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.WebHome]] forXWiki (e.g. [[Tomcat>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.configure-tomcat.WebHome]]or[[Jetty>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.configure-jetty.WebHome]]),withthe[[XWiki WAR>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.WebHome]]fileextracted/deployed.4 -1. Download and install[[MariaDB>>https://mariadb.org/]]followingitsofficialinstructions.Seethe[[Databasesupportstrategy>>dev:Community.SupportStrategy.DatabaseSupportStrategy]]forsupportedversions.5 -1. Downloadthe MariaDB JDBC driverand copyit intothe XWiki webapp's##WEB-INF/lib##directoryof the[[servletcontainer>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.WebHome]] chosen.(((6 - Download the [[MariaDB Connector/J>>https://mariadb.com/kb/en/about-mariadb-connector-j/]],orgetitfromthe[[Maven CentralRepository>>https://search.maven.org/artifact/org.mariadb.jdbc/mariadb-java-client]]. The JAR file is named ##mariadb-java-client-*.jar##.3 +1. Follow [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]] from beginning to end, installing MariaDB instead of MySQL — see the [[Database support strategy>>dev:Community.SupportStrategy.DatabaseSupportStrategy]] for the supported versions — with the three substitutions below. 4 +1. Call the ##mariadb## command-line client wherever that procedure calls ##mysql##. The two are the same program: MariaDB 11.0 dropped the ##mysql## name from its container images, where it had been a symbolic link. 5 +1. Copy the MariaDB JDBC driver into ##WEB-INF/lib##, in place of the MySQL one.((( 6 +Get [[MariaDB Connector/J>>https://mariadb.com/kb/en/about-mariadb-connector-j/]] from MariaDB or from [[Maven Central>>https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/]]. The JAR file is named ##mariadb-java-client-*.jar##, from the {{code language="none"}}org.mariadb.jdbc:mariadb-java-client{{/code}} artifact. 7 7 ))) 8 -1. Create the ##xwiki## database user and the ##xwiki## database. Use the ##mysql## command-line client:((( 9 -* Log in as root:((( 10 -{{code language="none"}} 11 -mysql -u root -p 12 -{{/code}} 13 -))) 14 -* Create the database with the required encoding:((( 15 -{{code language="none"}} 16 -CREATE DATABASE xwiki CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; 17 -{{/code}} 18 -))) 19 -* Create the ##xwiki## user:((( 20 -{{code language="none"}} 21 -CREATE USER 'xwiki'@'localhost' IDENTIFIED BY 'xwiki'; 22 -{{/code}} 23 -))) 24 -* Replace ##'xwiki'## with a strong password for production environments. 25 -* Grant all privileges on the database:((( 26 -{{code language="none"}} 27 -GRANT ALL PRIVILEGES ON xwiki.* TO 'xwiki'@'localhost'; 28 -FLUSH PRIVILEGES; 29 -{{/code}} 30 -))) 31 -* Verify the database was created:((( 32 -{{code language="none"}} 33 -SHOW DATABASES; 34 -{{/code}} 35 -))) 36 -))) 37 -1. Configure XWiki to use MariaDB. Open ##WEB-INF/hibernate.cfg.xml##, uncomment the existing MariaDB configuration block in your XWiki webapp and set the connection values:((( 8 +1. Uncomment the MariaDB configuration block of ##WEB-INF/hibernate.cfg.xml##, rather than the MySQL one, and comment out the other database configurations. It is the same block, with two different values:((( 38 38 {{code language="xml"}} 39 39 <property name="hibernate.connection.url">jdbc:mariadb://localhost/xwiki?useSSL=false</property> 40 - <property name="hibernate.connection.username">xwiki</property> 41 - <property name="hibernate.connection.password">xwiki</property> 42 42 <property name="hibernate.connection.driver_class">org.mariadb.jdbc.Driver</property> 43 - <property name="hibernate.dbcp.poolPreparedStatements">true</property> 44 - <property name="hibernate.dbcp.maxOpenPreparedStatements">20</property> 45 - 46 - <property name="hibernate.connection.charSet">UTF-8</property> 47 - <property name="hibernate.connection.useUnicode">true</property> 48 - <property name="hibernate.connection.characterEncoding">utf8</property> 49 49 {{/code}} 50 - 51 -Adjust the host, port, or database name if your setup differs. For production environments, configure SSL and use a strong password. 52 52 ))) 53 -1. RestartXWiki to applythechanges.54 - 1. Open your wiki in a browser. XWiki connects to MariaDB, creates its tables on first start, and serves the wiki without a database error.14 +1. Open your wiki in a browser. XWiki connects to MariaDB, creates its tables on the first start, and serves the wiki without a database error. 15 +
- DocApp.Code.DocumentationClass[0]
-
- FAQ
-
... ... @@ -1,6 +1,6 @@ 1 1 == Can I use a different database name or user? == 2 2 3 -Yes. Replace ##xwiki## with your preferrednamesinthe creation steps and in the ##connection.url## property.3 +Yes. Replace ##xwiki## in the creation statements and in the ##hibernate.connection.url## property; the create-database step of the MySQL procedure also has you set the ##xwiki.db## property when the main wiki's database is not called ##xwiki##. 4 4 5 5 == How do I remove the database if needed? == 6 6 ... ... @@ -15,4 +15,4 @@ 15 15 16 16 == What database encoding and collation should I use? == 17 17 18 - XWiki expects the database to use##UTF-8##encodingwithabinarycollation.It supportsboth##utf8##and##utf8mb4##, but##utf8mb4## withthe##utf8mb4_bin##collationisstrongly recommended.18 +##utf8mb4## with the ##utf8mb4_bin## collation, on the InnoDB storage engine. Both are requirements rather than recommendations, and they are the same ones XWiki has for MySQL. - Related
-
... ... @@ -1,0 +1,2 @@ 1 +* [[Install and Configure a Relational Database>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.WebHome]]. 2 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]].
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +Convert a MySQL Database to utf8mb4 - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,43 @@ 1 +This converts a MySQL database created with the wrong character set to the ##utf8mb4## character set and ##utf8mb4_bin## collation that XWiki expects — [[MySQL Storage Engine and Character Set>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]] explains why that pair is a requirement. Nothing in XWiki converts an existing database's character set, so this is a manual operation on a stopped instance. 2 + 3 +1. Stop XWiki, then back up the database with the [[database backup commands>>doc:documentation.xs.admin.backup.database-commands.WebHome]]: the conversion rewrites every table and cannot be undone. 4 +1. Save this script and run it as the MySQL root user, passing the database name as its only argument (it defaults to ##xwiki##):((( 5 +{{code language="bash"}} 6 +#!/bin/bash 7 + 8 +db="${1:-xwiki}" 9 + 10 +to_character_set=utf8mb4 11 +to_collation=utf8mb4_bin 12 + 13 +mysql_cmd="mysql -u root" 14 + 15 +echo "Changing ($db) character to $to_collation." 16 + 17 +$mysql_cmd -e "ALTER DATABASE $db CHARACTER SET $to_character_set COLLATE $to_collation;" 18 + 19 +TBL_LIST=$($mysql_cmd -N -s -r -e "use $db;show tables;") 20 + 21 +for tbl_name in $TBL_LIST; 22 +do 23 +$mysql_cmd -e "SET FOREIGN_KEY_CHECKS=0; alter table $db.$tbl_name convert to character set $to_character_set collate $to_collation; SET FOREIGN_KEY_CHECKS=1;" 24 +done 25 + 26 +echo "Here the result of the operation:" 27 +$mysql_cmd -e "USE $db;SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=DATABASE();" 28 +{{/code}} 29 + 30 +It sets the database's own default character set and collation, converts each of its tables in turn, and prints the collation of every column it produced. If the MySQL root user has a password, add the ##-p## option to the ##mysql_cmd## line and each call prompts for it. 31 +))) 32 +1. Run the script again for each subwiki's database: it converts one database at a time. 33 +1. Start XWiki. 34 +1. Confirm that no column was left behind. The script's closing query lists the collation of every column; asking it for the columns that are //not// on the target collation turns it into a single check:((( 35 +{{code language="sql"}} 36 +SELECT TABLE_NAME, COLUMN_NAME, COLLATION_NAME 37 + FROM INFORMATION_SCHEMA.COLUMNS 38 + WHERE TABLE_SCHEMA = 'xwiki' AND COLLATION_NAME <> 'utf8mb4_bin'; 39 +{{/code}} 40 + 41 +An empty result is the confirmation: every text column of the database is on ##utf8mb4_bin##, and the wiki that starts on it stores four-byte characters correctly. 42 +))) 43 +
- DocApp.Code.DocumentationClass[0]
-
- FAQ
-
... ... @@ -1,0 +1,3 @@ 1 +== Why does the script fail with an ERROR 1118 row-size error? == 2 + 3 +Because the database was never upgraded through a version carrying the column-type migration XWiki runs for itself. [["Row size too large" MySQL Error>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.row-size-limit.WebHome]] has the diagnosis and the fix — do not widen the columns by hand. - Related
-
... ... @@ -1,0 +1,2 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 2 +* [[Migrate MySQL databases to utf8mb4>>snippets:Extension.Migrate MySQL databases to utf8mb4.WebHome]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +howto
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +Convert MyISAM Tables to InnoDB - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,54 @@ 1 +A database inherited from an old MySQL installation may still hold MyISAM tables. This converts them to InnoDB, the transactional storage engine XWiki requires, [[MySQL Storage Engine and Character Set>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]] explains what breaks without it. 2 + 3 +1. Stop XWiki, then back up the database with the [[database backup commands>>doc:documentation.xs.admin.backup.database-commands.WebHome]]: changing a table's engine rewrites it and cannot be undone. 4 +1. List the engine of every table, replacing ##xwiki## with your database name if it differs:((( 5 +{{code language="sql"}} 6 +SELECT table_name, engine FROM information_schema.tables WHERE table_schema = 'xwiki'; 7 +{{/code}} 8 + 9 +Every table reporting ##MyISAM## has to be converted. If none does, there is nothing to do here. 10 +))) 11 +1. Save this script and run it as the MySQL root user:((( 12 +{{code language="bash"}} 13 +#!/bin/bash 14 + 15 +MYSQL_COMMAND=mysql 16 +TO_ENGINE=INNODB 17 + 18 +DATABASES=$(mysql -N -s -r -e 'show databases'|grep -v ^information_schema$|grep -v ^mysql$) 19 + 20 +for db in $DATABASES 21 +do 22 + 23 +echo "Working on database $db..." 24 +echo "" 25 + 26 +TABLES=$(mysql -N -s -r -e "show tables from $db;") 27 + 28 +for tb in $TABLES 29 +do 30 + 31 +$MYSQL_COMMAND -e "ALTER TABLE $db.$tb ENGINE = $TO_ENGINE;" 32 + 33 +done 34 + 35 +$MYSQL_COMMAND -e "SELECT table_name,Engine,table_collation FROM information_schema.tables WHERE table_schema = '$db';" 36 + 37 +echo "" 38 +echo "" 39 + 40 +done 41 +{{/code}} 42 + 43 +It walks every database of the server except ##information_schema## and ##mysql##, converts each of their tables to InnoDB, and prints the engine and collation of the tables it produced. On a server that also hosts databases other than the wiki's, narrow the ##DATABASES## line to the wiki's own databases before running it. If the MySQL user needs credentials, add ##-u root -p## to each ##mysql## call. 44 +))) 45 +1. Start XWiki. 46 +1. Confirm that no table was left on the old engine. Asking for the tables that are //not// on InnoDB turns the script's closing query into a single check:((( 47 +{{code language="sql"}} 48 +SELECT table_name, engine, table_collation 49 + FROM information_schema.tables 50 + WHERE table_schema = 'xwiki' AND engine <> 'InnoDB'; 51 +{{/code}} 52 + 53 +An empty result is the confirmation: every table of the database is on InnoDB, so a save that fails halfway through is rolled back instead of leaving the wiki inconsistent. 54 +)))
- DocApp.Code.DocumentationClass[0]
-
- Related
-
... ... @@ -1,0 +1,2 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 2 +* [[Convert a MySQL Database to utf8mb4>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-database-utf8mb4.WebHome]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +howto
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +"Packet for query is too large" MySQL Error - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,25 @@ 1 +Saving a large document or a large attachment fails, and the logs show: 2 + 3 +{{code language="none"}} 4 +Packet for query is too large (max_allowed_packet) 5 +{{/code}} 6 + 7 +The same limit also stops a fresh installation before anything visible goes wrong: XWiki starts without an error, but the import of the default set of pages fails part-way through. 8 + 9 +=== Cause === 10 + 11 +MySQL refuses any single query larger than the size its ##max_allowed_packet## variable allows, and XWiki stores a page's content and an attachment's data as single values. One large save is therefore one large query, and MySQL rejects it outright, what decides is the size of the individual document, not the size of the database. 12 + 13 +The default value belongs to MySQL and has changed between versions, so read it from [[MySQL's manual page for the variable>>https://dev.mysql.com/doc/refman/8.4/en/max-allowed-packet.html]] rather than assuming it. 14 + 15 +=== Solution === 16 + 17 +1. Open the MySQL server's configuration file. On Linux this is ##/etc/my.cnf##. On Windows it is the ##my.ini## file that the MySQL service names as its defaults file in its start-up arguments, which the service's own configuration shows. 18 +1. Raise ##max_allowed_packet## in the server section, using a value larger than the biggest document or attachment you expect. ##32M## is a sensible starting point:((( 19 +{{code language="ini"}} 20 +[mysqld] 21 +max_allowed_packet=32M 22 +{{/code}} 23 +))) 24 +1. Restart the MySQL server so that it reads the new value. 25 +1. Retry what failed. The document or attachment is saved, and on a new installation the default set of pages imports to the end.
- DocApp.Code.DocumentationClass[0]
-
- Related
-
... ... @@ -1,0 +1,1 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +explanation
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +Optional MySQL Indexes - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,46 @@ 1 +Each statement below indexes a column that XWiki reads but that its Hibernate mappings leave unindexed. The list is a menu rather than a checklist: measure the query that is slow, then add the one index that serves it. Create them as the wiki's own database user, and once per database, since XWiki gives every subwiki a database of its own. 2 + 3 +=== General indexes === 4 + 5 +|=Index|=Table and column|=What reads it 6 +|##xwl_value##|##xwikilargestrings (xwl_value(50))##|The value of every Large String and TextArea object property. XWiki groups over this column when a Database List field offers the values already in use, and matches it with {{code language="none"}}like{{/code}} in the REST keyword search. 7 +|##xwd_parent##|##xwikidoc (xwd_parent(50))##|The queries that list the children or the orphans of a page test it for equality. 8 +|##xwd_class_xml##|##xwikidoc (xwd_class_xml(20))##|Listing the XClasses of a wiki tests this column for an XML prefix. 9 +|##xda_docid1##|##xwikiattrecyclebin (xda_docid)##|Every listing of a page's deleted attachments filters on it, while its neighbours ##xda_filename##, ##xda_date## and ##xda_doc_name## are indexed by the mapping. 10 +|##solr_iterate_all_documents##|##xwikidoc (XWD_WEB(500), XWD_NAME(253), XWD_LANGUAGE(5), XWD_VERSION(10))##|To work out which pages the Solr index is missing, XWiki walks the whole ##xwikidoc## table reading exactly these columns. 11 + 12 +{{code language="sql"}} 13 +create index xwl_value on xwikilargestrings (xwl_value(50)); 14 +create index xwd_parent on xwikidoc (xwd_parent(50)); 15 +create index xwd_class_xml on xwikidoc (xwd_class_xml(20)); 16 +create index xda_docid1 on xwikiattrecyclebin (xda_docid); 17 +create index solr_iterate_all_documents on xwikidoc (XWD_WEB(500), XWD_NAME(253), XWD_LANGUAGE(5), XWD_VERSION(10)); 18 +{{/code}} 19 + 20 +=== Statistics indexes === 21 + 22 +XWiki's statistics module stores page views, referers and visits in three tables of its own, and storing them is switched off unless a wiki asks for it: the shipped ##xwiki.cfg## sets ##xwiki.stats.default=0##, because statistics cost space and write time. These nine indexes are therefore worth considering only on an instance that turned statistics on, and only once those three tables have grown. 23 + 24 +|=Index|=Table and column 25 +|##xws_number##|##xwikistatsdoc (XWS_NUMBER)## 26 +|##xws_classname##|##xwikistatsdoc (XWS_CLASSNAME)## 27 +|##xwr_number##|##xwikistatsreferer (XWR_NUMBER)## 28 +|##xwr_classname##|##xwikistatsreferer (XWR_CLASSNAME)## 29 +|##xwr_referer##|##xwikistatsreferer (XWR_REFERER(50))## 30 +|##xwv_user_agent##|##xwikistatsvisit (XWV_USER_AGENT(255))## 31 +|##xwv_cookie##|##xwikistatsvisit (XWV_COOKIE(255))## 32 +|##xwv_classname##|##xwikistatsvisit (XWV_CLASSNAME)## 33 +|##xwv_number##|##xwikistatsvisit (XWV_NUMBER)## 34 + 35 +{{code language="sql"}} 36 +create index xws_number on xwikistatsdoc (XWS_NUMBER); 37 +create index xws_classname on xwikistatsdoc (XWS_CLASSNAME); 38 +create index xwr_number on xwikistatsreferer (XWR_NUMBER); 39 +create index xwr_classname on xwikistatsreferer (XWR_CLASSNAME); 40 +create index xwr_referer on xwikistatsreferer (XWR_REFERER(50)); 41 +create index xwv_user_agent on xwikistatsvisit (XWV_USER_AGENT(255)); 42 +create index xwv_cookie on xwikistatsvisit (XWV_COOKIE(255)); 43 +create index xwv_classname on xwikistatsvisit (XWV_CLASSNAME); 44 +create index xwv_number on xwikistatsvisit (XWV_NUMBER); 45 +{{/code}} 46 +
- DocApp.Code.DocumentationClass[0]
-
- FAQ
-
... ... @@ -1,0 +1,11 @@ 1 +== Does an upgrade create or remove these indexes? == 2 + 3 +No. XWiki creates only the indexes declared in its Hibernate mappings, so these are yours to create on each new database and to recreate if you ever drop them. 4 + 5 +== Which of them does my instance need? == 6 + 7 +Measure before creating any. Each one costs write time on a table XWiki writes to constantly, and only repays that on an instance whose page tree, recycle bin, Solr synchronization or statistics is measurably slow. 8 + 9 +== Are these indexes specific to MySQL? == 10 + 11 +The columns are not, but the statements are: the lengths in brackets are MySQL's prefix-index syntax for a long text column, which other databases express differently. See [[Optional Oracle Indexes>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-oracle-manually.optional-indexes.WebHome]] for the Oracle equivalent. - Related
-
... ... @@ -1,0 +1,3 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 2 +* [[Database Administration>>Documentation.AdminGuide.Performances.Database Administration.WebHome]]. 3 +* [[Optional Oracle Indexes>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-oracle-manually.optional-indexes.WebHome]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +reference
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +"Row size too large" MySQL Error - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,28 @@ 1 +Two MySQL errors report the same problem. XWiki logs the first at run time, when it writes a row that does not fit: 2 + 3 +{{code language="none"}} 4 +MySQLSyntaxErrorException: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. 5 +{{/code}} 6 + 7 +The second comes from the ##mysql## client, when a manual character-set conversion of an old database rewrites a table, usually ##xwikistatsvisit##: 8 + 9 +{{code language="none"}} 10 +ERROR 1118 (42000) at line 1: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs 11 +{{/code}} 12 + 13 +=== Cause === 14 + 15 +Both messages suggest changing the row format or widening columns, and XWiki already does both for the tables it owns. 16 + 17 +It sets the row format itself. XWiki's MySQL adapter issues {{code language="none"}}ALTER TABLE <table> ROW_FORMAT=<format>{{/code}} for its own tables, using ##Dynamic## by default and ##Compressed## for the tables it compresses, compression is enabled by default on MySQL and MariaDB, through the ##xwiki.compressionAllowed## property of the ##WEB-INF/hibernate.cfg.xml## file. Setting a row format by hand therefore lasts only until XWiki sets its own back. 18 + 19 +It has also narrowed the columns that used to overflow the limit. The data migration ##R130200000XWIKI17200DataMigration##, whose stated purpose is to make the rows fit the maximum allowed size, converts to ##LONGTEXT## exactly the columns this error used to come from: ##activitystream_events## (url, title, body, param1 to param5), ##xwikistatsreferer## (referer), ##xwikistatsvisit## (userAgent, cookie) and ##xwikipreferences## (leftPanels, rightPanels, documentBundles). It arrived in XWiki 13.2, was backported to 12.10.6, and runs on its own when the database is upgraded. 20 + 21 +So on a current instance the error means one of two things: the database was never upgraded through a version carrying that migration, which is why it most often shows up while converting an old database by hand, or the row that overflows is not one of XWiki's at all. 22 + 23 +=== Solution === 24 + 25 +1. Check which XWiki version last upgraded the database, and start the instance on a current XWiki so that the database upgrade runs. The migration applies itself; there is no SQL to type and no column to widen by hand. 26 +1. Retry what failed, the save that was rejected, or the character-set conversion. 27 +1. If the database is already migrated and the error persists, the overflowing row belongs to a table XWiki does not own. The message names that table, and the row limit is then the MySQL server's to deal with rather than XWiki's. 28 +1. XWiki writes the row, or the conversion runs to its end, without the error returning.
- DocApp.Code.DocumentationClass[0]
-
- Related
-
... ... @@ -1,0 +1,2 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 2 +* [[Convert a MySQL Database to utf8mb4>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-database-utf8mb4.WebHome]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +explanation
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +"The server timezone value is unrecognized" MySQL Error - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,24 @@ 1 +XWiki fails to connect to MySQL, and the JDBC driver reports: 2 + 3 +{{code language="none"}} 4 +The server timezone value 'CDT' is unrecognized or represents more than one timezone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc timezone value if you want to utilize timezone support. 5 +{{/code}} 6 + 7 +=== Cause === 8 + 9 +The MySQL JDBC driver asks the server which time zone it runs in, because it converts date and time values between the two, and it needs an answer that identifies exactly one zone. The abbreviation the server returned, ##CDT## in the message above , names more than one, so the driver cannot tell which offset to apply and refuses the connection instead of guessing. XWiki configures no time zone of its own: the requirement belongs to the driver, and either end of the connection can satisfy it. 10 + 11 +=== Solution === 12 + 13 +1. Name the time zone as a connection property in the MySQL block of the ##WEB-INF/hibernate.cfg.xml## file, next to the other connection properties it already sets:((( 14 +{{code language="xml"}} 15 + <property name="hibernate.connection.serverTimezone">Europe/Berlin</property> 16 +{{/code}} 17 +))) 18 +1. Or append it to the connection URL in the same file, which suits an instance that keeps everything in one property:((( 19 +{{code language="none"}} 20 +jdbc:mysql://localhost:3306/xwiki?serverTimezone=UTC 21 +{{/code}} 22 +))) 23 +1. Or give the MySQL server itself an unambiguous time zone, in its own configuration file, so that every client it serves gets a usable answer. 24 +1. Restart XWiki. Any one of the three is enough: the connection is established and the wiki starts normally.
- DocApp.Code.DocumentationClass[0]
-
- Related
-
... ... @@ -1,0 +1,1 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +explanation
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki Cannot Connect to MySQL - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,25 @@ 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. 25 +
- DocApp.Code.DocumentationClass[0]
-
- Related
-
... ... @@ -1,0 +1,2 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 2 +* [["Unknown database" MySQL Error>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.unknown-database.WebHome]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +explanation
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +MySQL Storage Engine and Character Set - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,34 @@ 1 +XWiki's Hibernate store makes two assumptions about the MySQL schema it is given: that its tables are transactional, and that its character set can hold any character a user may type. Both are decided when the database is created and are awkward to change afterwards, which is why [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]] creates the database with an explicit storage engine and character set instead of accepting MySQL's defaults. 2 + 3 +== Storage engine == 4 + 5 +XWiki must run on **InnoDB**, MySQL's transactional storage engine. 6 + 7 +Every write XWiki performs is wrapped in a transaction. When a save fails halfway through, the store rolls that transaction back and the database returns to its last known good state. A storage engine without transaction support accepts the rollback and does nothing: the half-applied write stays, and the wiki keeps a document whose parts disagree with each other. Nothing reports this when it happens; it surfaces later as pages that can no longer be loaded or saved. 8 + 9 +XWiki also inspects its tables through InnoDB's own metadata tables in ##information_schema##, so the store's checks on how a table is stored return nothing at all for a table held by another engine. 10 + 11 +InnoDB is the default engine on every supported MySQL version, so a database created today already complies. Only a database inherited from an old installation is worth checking, and [[Convert MyISAM Tables to InnoDB>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-myisam-tables-innodb.WebHome]] converts in place whatever it still holds on the old engine. 12 + 13 +== Character set and collation == 14 + 15 +XWiki expects the ##utf8mb4## character set with the ##utf8mb4_bin## collation. That pair is a requirement, not a preference, and MySQL's ##utf8## is the trap next to it: ##utf8## is an alias for ##utf8mb3##, which stores at most three bytes per character and therefore cannot store a four-byte character at all. Those four-byte characters are the ones users reach for most visibly, an emoji in a page title, in page content or in a comment, and on ##utf8mb3## they are rejected or mangled rather than saved. ##utf8mb4## is the character set that holds them, and ##utf8mb4_bin## is the collation XWiki uses for its own databases and runs its functional tests against. MySQL 8 already defaults to ##utf8mb4##, but not to the binary collation. 16 + 17 +Getting the main wiki's database right is also what makes every later subwiki right. When XWiki creates the database of a new subwiki, it reads the main wiki's character set and collation and creates the subwiki with the same pair, so a main database left on ##utf8mb3## passes that limitation on to every subwiki created after it, each of which then has to be converted on its own. 18 + 19 +Setting the character set and collation per database, as the installation procedure does, is enough. Setting them on the server instead makes every database that anyone creates comply by default, it is what XWiki's own functional tests do when they start their MySQL container: 20 + 21 +{{code language="none"}} 22 +character-set-server=utf8mb4 23 +collation-server=utf8mb4_bin 24 +{{/code}} 25 + 26 +The database is only half of the path a character travels. The other half is the JVM running XWiki's servlet container, and on Java 17 the JVM's default encoding still follows the platform locale. If that locale is not UTF-8, characters are stored wrongly whatever the database is set to, so start the servlet container with: 27 + 28 +{{code language="none"}} 29 +-Dfile.encoding=utf8 30 +{{/code}} 31 + 32 +The Tomcat packages of most Linux distributions already set it, but not all of them, so it is worth confirming. On Java 18 and later the flag is a no-op, since UTF-8 became the JVM's default encoding. 33 + 34 +An existing database on the wrong character set does not have to be rebuilt: [[Convert a MySQL Database to utf8mb4>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-database-utf8mb4.WebHome]] converts it, its tables and its columns in place.
- DocApp.Code.DocumentationClass[0]
-
- Related
-
... ... @@ -1,0 +1,2 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 2 +* [[Database Support Strategy>>dev:Community.SupportStrategy.DatabaseSupportStrategy]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +explanation
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +"Unknown database" MySQL Error - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,0 +1,21 @@ 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.methods.install-xwiki-war.install-relational-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.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]] describes. 21 +1. Restart XWiki. It connects to the database the configuration names and creates its tables there.
- DocApp.Code.DocumentationClass[0]
-
- Related
-
... ... @@ -1,0 +1,2 @@ 1 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 2 +* [[XWiki Cannot Connect to MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.server-unreachable.WebHome]]. - Target
-
... ... @@ -1,0 +1,1 @@ 1 +administrator - Type
-
... ... @@ -1,0 +1,1 @@ 1 +explanation
- DocApp.Code.DocumentationExtensionClass[0]
-
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. ThomasMortagne1 +XWiki.elenicojocariu - Content
-
... ... @@ -2,336 +2,61 @@ 2 2 {{toc/}} 3 3 {{/box}} 4 4 5 +This documentation has moved to [[Configure MySQL>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]] and the pages below it. 6 + 5 5 = Compatibility Considerations = 6 6 7 -See [[ Databasesupportstrategy>>dev:Community.DatabaseSupportStrategy]] forthesupported versions.9 +See [[MySQL Storage Engine and Character Set>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]]. 8 8 9 -XWiki expects the database to use ##utf8## or ##utf8mb4## encoding with collation ##*_bin## and it's highly recommended to use ##utf8mb4## (and ##utf8mb4_bin##) which is the default since MySQL 8. 10 - 11 11 == MyISAM storage engine == 12 12 13 -My ISAM(the default storageenginefor MySQL untilrelease5.5.5 in 2010)doesnotsupporttransactions.Ifthereisan errorwhile datais beingsavedtothedatabase, XWiki will attempttoroll back the transaction to its previousknown goodstate. If you use MyISAM,itwilldonothing,leavingthedatabaseinwhateverstate it wasinwhentheerror occurred.13 +See [[MySQL Storage Engine and Character Set>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]] and [[Convert MyISAM Tables to InnoDB>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-myisam-tables-innodb.WebHome]]. 14 14 15 -{{warning}} 16 -If you use MySQL with any engine that does not support transactions, you will most likely corrupt your database.** We highly recommend using a storage engine such as InnoDB which supports transactions.** 17 -{{/warning}} 18 - 19 -== MySQL versions older than 5.0 == 20 - 21 -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. 22 - 23 -== MySQL versions older than 5.7 and utf8mb4 == 24 - 25 -If you use utf8mb4 encoding, you won't be able to use a 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. 26 - 27 27 == JDBC Driver Version == 28 28 29 - *It'srecommendedtousethelatestversionoftheMySQL JDBC driver.17 +See [[Configure MySQL>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 30 30 31 31 = Installation Steps = 32 32 33 - Follow these instructions:21 +See [[Configure MySQL>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. If saving a large document or attachment fails once XWiki runs, see [["Packet for query is too large" MySQL Error>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.max-allowed-packet.WebHome]]. 34 34 35 -* Install MySQL and start it. It's always recommended to use the best method depending on your environment (for example a package on a Linux server), you can download it on [[MySQL>>http://www.mysql.com/]] if you want to manually install it. 36 -* 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.((( 37 -You can create the database in several ways. For example use: 38 - 39 -{{code language="shell"}} 40 -mysql -u root -e "create database xwiki default character set utf8mb4 collate utf8mb4_bin" 41 -{{/code}} 42 -))) 43 -* Create the ##xwiki## user with password ##xwiki##((( 44 -{{code language="shell"}} 45 -mysql -u root -e "CREATE USER 'xwiki'@'localhost' IDENTIFIED BY 'xwiki'"; 46 -{{/code}} 47 -))) 48 -* In XWiki, each subwiki has its own dedicated database, therefore, to use this feature, you will need to give privileges to the ##xwiki## user for accessing and creating any database databases. Specifically, the ##xwiki## users needs permissions to be able to execute {{code language="sql"}}CREATE DATABASE{{/code}}, {{code language="sql"}}DROP SCHEMA{{/code}}, and then all CRUD operations on tables. Note that the command below could be tuned to be more restrictive depending on your need:((( 49 -{{code language="shell"}} 50 -mysql -u root -e "grant all privileges on *.* to xwiki@localhost" 51 -{{/code}} 52 -))) 53 -* 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/downloads/connector/j/]] or directly from the [[Maven Central Repository>>https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/]].((( 54 -{{warning}} 55 -It's generally recommended to use the latest one. 56 -{{/warning}} 57 -))) 58 -* 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:((( 59 -{{code language="xml"}} 60 -<property name="connection.url">jdbc:mysql://localhost/xwiki</property> 61 -<property name="connection.username">xwiki</property> 62 -<property name="connection.password">xwiki</property> 63 -<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property> 64 -<property name="connection.useUnicode">true</property> 65 -<property name="connection.characterEncoding">UTF-8</property> 66 -{{/code}} 67 - 68 -{{info}} 69 -* By default MySQL only accepts packets that are 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 {{code language='shell'}}mysqld --console --max_allowed_packet=32M{{/code}} or you can modify directly the ##my.cnf## configuration file to set this value permanently. 70 -* If an empty XWiki starts with no errors, but you are unable to upload the default set of pages (XAR file) try to increase the ##max_allowed_packet## parameter as shown above. 71 -{{/info}} 72 -))) 73 - 74 74 = Indexes = 75 75 76 -See [[ Database Administration>>Documentation.AdminGuide.Performances.DatabaseAdministration.WebHome]].25 +See [[Optional MySQL Indexes>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.optional-indexes.WebHome]]. 77 77 78 -{{code language="mysql"}} 79 -// Required 80 -create index xwl_value on xwikilargestrings (xwl_value(50)); 81 -create index xwd_parent on xwikidoc (xwd_parent(50)); 82 -create index xwd_class_xml on xwikidoc (xwd_class_xml(20)); 83 -create index xda_docid1 on xwikiattrecyclebin (xda_docid); 84 -create index solr_iterate_all_documents on xwikidoc (XWD_WEB(500), XWD_NAME(253), XWD_LANGUAGE(5), XWD_VERSION(10)); 85 -// Only required if you use stats (feature is off by default) 86 -create index xws_number on xwikistatsdoc (XWS_NUMBER); 87 -create index xws_classname on xwikistatsdoc (XWS_CLASSNAME); 88 -create index xwr_number on xwikistatsreferer (XWR_NUMBER); 89 -create index xwr_classname on xwikistatsreferer (XWR_CLASSNAME); 90 -create index xwr_referer on xwikistatsreferer (XWR_REFERER(50)); 91 -create index xwv_user_agent on xwikistatsvisit (XWV_USER_AGENT(255)); 92 -create index xwv_cookie on xwikistatsvisit (XWV_COOKIE(255)); 93 -create index xwv_classname on xwikistatsvisit (XWV_CLASSNAME); 94 -create index xwv_number on xwikistatsvisit (XWV_NUMBER); 95 -{{/code}} 96 - 97 -{{info}} 98 -Note to XWiki developers: The following indexes could be created automatically since they're less than 768 characters and thus should be added in a future version of XWiki so that they don't need to be created manually: 99 - 100 -{{code language="mysql"}} 101 -create index xws_number on xwikistatsdoc (XWS_NUMBER); 102 -create index xws_classname on xwikistatsdoc (XWS_CLASSNAME); 103 -create index xwr_number on xwikistatsreferer (XWR_NUMBER); 104 -create index xwr_classname on xwikistatsreferer (XWR_CLASSNAME); 105 -create index xwv_classname on xwikistatsvisit (XWV_CLASSNAME); 106 -create index xwv_number on xwikistatsvisit (XWV_NUMBER); 107 -create index xda_docid1 on xwikiattrecyclebin (xda_docid); 108 -{{/code}} 109 -{{/info}} 110 - 111 111 = Tips = 112 112 113 113 == MySQL 8 == 114 114 115 -* If you're using MySQL 8+ you'll need to configure MySQL with native password: ##default-authentication-plugin=mysql_native_password##. 116 -* You'll also be able to switch from ##com.mysql.jdbc.Driver## to ##com.mysql.cj.jdbc.Driver## JDBC driver (since the previous driver class is now deprecated). 117 -* If you get the following error then you'll need to force the timezone to use either by setting it in:((( 118 -* The MySQL conf file on the server 119 -* In the XWiki ##hibernate.cfg.xml## file in the ##hibernate.connection.serverTimezone## property (e.g. ##<property name="hibernate.connection.serverTimezone">Europe/Berlin</property>##). 120 -* In the XWiki ##hibernate.cfg.xml## file inside the JDBC URL string as in ##jdbc:mysql:~/~/localhost:3306/myschema?serverTimezone=UTC## 31 +See [["The server timezone value is unrecognized" MySQL Error>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.server-timezone-unrecognized.WebHome]]. 121 121 122 -{{code language="none"}} 123 -The server timezone value 'CDT' is unrecognized or represents more than one timezone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc timezone value if you want to utilize timezone support. 124 -{{/code}} 125 - 126 -For more details see [[this explanation post>>https://stackoverflow.com/a/54256150/153102]]. 127 -))) 128 - 129 129 == Convert a database to utf8mb4/utf8mb4_bin == 130 130 131 -{{code language="shell"}} 132 -#!/bin/bash 35 +See [[Convert a MySQL Database to utf8mb4>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-database-utf8mb4.WebHome]]. 133 133 134 -db="${1:-xwiki}" 135 - 136 -to_character_set=utf8mb4 137 -to_collation=utf8mb4_bin 138 - 139 -mysql_cmd="mysql -u root" 140 - 141 -echo "Changing ($db) character to $to_collation." 142 - 143 -$mysql_cmd -e "ALTER DATABASE $db CHARACTER SET $to_character_set COLLATE $to_collation;" 144 - 145 -TBL_LIST=$($mysql_cmd -N -s -r -e "use $db;show tables;") 146 - 147 -for tbl_name in $TBL_LIST; 148 -do 149 -$mysql_cmd -e "SET FOREIGN_KEY_CHECKS=0; alter table $db.$tbl_name convert to character set $to_character_set collate $to_collation; SET FOREIGN_KEY_CHECKS=1;" 150 -done 151 - 152 -echo "Here the result of the operation:" 153 -$mysql_cmd -e "USE $db;SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=DATABASE();" 154 -{{/code}} 155 - 156 -{{info}} 157 -In case the above script fails with "ERROR 1118 (42000) at line 1: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs 158 -xwikistatsvisit", you can use the following SQL statements to change tables column types to LONGTEXT to be able to convert the tables to utf8mb4. 159 -{{/info}} 160 - 161 -{{code}} 162 -ALTER TABLE activitystream_events MODIFY ase_url LONGTEXT, MODIFY ase_title LONGTEXT, MODIFY ase_body LONGTEXT, MODIFY ase_param1 LONGTEXT, MODIFY ase_param2 LONGTEXT, MODIFY ase_param3 LONGTEXT, MODIFY ase_param4 LONGTEXT, MODIFY ase_param5 LONGTEXT; 163 -ALTER TABLE xwikistatsreferer MODIFY XWR_REFERER LONGTEXT; 164 -ALTER TABLE xwikistatsvisit MODIFY XWV_USER_AGENT LONGTEXT, MODIFY XWV_COOKIE LONGTEXT; 165 -ALTER TABLE xwikipreferences MODIFY XWP_LEFT_PANELS LONGTEXT, MODIFY XWP_RIGHT_PANELS LONGTEXT, MODIFY XWP_DOCUMENT_BUNDLES LONGTEXT; 166 -{{/code}} 167 - 168 -You can also look at [[this snippet to perform this conversion inside XWiki>>snippets:Extension.Migrate MySQL databases to utf8mb4]]. 169 - 170 170 == Convert from MyISAM to InnoDB == 171 171 172 -{{code language="shell"}} 173 -#!/bin/bash 39 +See [[Convert MyISAM Tables to InnoDB>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.convert-myisam-tables-innodb.WebHome]]. 174 174 175 -MYSQL_COMMAND=mysql 176 -TO_ENGINE=INNODB 177 - 178 -DATABASES=$(mysql -N -s -r -e 'show databases'|grep -v ^information_schema$|grep -v ^mysql$) 179 - 180 -for db in $DATABASES 181 -do 182 - 183 -echo "Working on database $db..." 184 -echo "" 185 - 186 -TABLES=$(mysql -N -s -r -e "show tables from $db;") 187 - 188 -for tb in $TABLES 189 -do 190 - 191 -$MYSQL_COMMAND -e "ALTER TABLE $db.$tb ENGINE = $TO_ENGINE;" 192 - 193 -done 194 - 195 -$MYSQL_COMMAND -e "SELECT table_name,Engine,table_collation FROM information_schema.tables WHERE table_schema = DATABASE();" 196 - 197 -echo "" 198 -echo "" 199 - 200 -done 201 -{{/code}} 202 - 203 203 = Troubleshooting = 204 204 205 205 == "Incorrect string value" error with MySQL connector between 8.0.29 and 8.0.32 == 206 206 207 -{{info}} 208 - This is fixed in the connector 8.0.33. 209 -{{/info}} 45 +See [[MySQL Storage Engine and Character Set>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]]. 210 210 211 -There seems to be a regression in MySQL connector 8.0.29 that leads to using the default encoding even when it's explicitly indicated in the hibernate.cfg.xml file (which is what you have in the MySQL configuration recommendation provided by XWiki). We are currently searching what could be the cause and find a workaround in https://jira.xwiki.org/browse/XWIKI-19853 but in the (and in general) it's recommended to make sure that you are running XWiki with the right default Java encoding. You can do that by making sure Java is run with ##-Dfile.encoding=utf8## (this is generally the default in standard Tomcat packages of various Linux distribution, but it might not always be the case). 212 - 213 213 == Unable to login to MySQL Console == 214 214 215 -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. 216 -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. 49 +See [[Configure MySQL>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 217 217 218 -== Can't create test file == 219 - 220 -When running ##mysqld ~-~-console## you may get the following (especially if you're on a Mac): 221 - 222 -{{code language="none"}} 223 -071111 17:20:53 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-i686/data/Vincent.lower-test 224 -071111 17:20:53 [Warning] Can't create test file /usr/local/mysql-5.0.45-osx10.4-i686/data/Vincent.lower-test 225 -mysqld: Can't change dir to '/usr/local/mysql-5.0.45-osx10.4-i686/data/' (Errcode: 13) 226 -071111 17:20:53 [ERROR] Aborting 227 -{{/code}} 228 - 229 -To start MySQL run the following command instead: 230 - 231 -{{code}} 232 -sudo /usr/local/mysql/bin/mysqld_safe --user=mysql 233 -{{/code}} 234 - 235 -== Data Truncation Error == 236 - 237 -If you receive an Exception like the following while installing/upgrading XWiki, chances are that you are using an outdated version of MySQLConnectorJ. 238 - 239 -{{code language="none"}} 240 -Caused by: java.sql.BatchUpdateException: Data truncation: Out of 241 -range value adjusted for column 'XWD_HIDDEN' at row 1 242 - at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:894) 243 - at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294) 244 - at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294) 245 - at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48) 246 - at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246) 247 -{{/code}} 248 - 249 -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. 250 - 251 -Upgrading to the latest version of MySQLConnectorJ should solve such an error in most of the cases. 252 - 253 253 == HTTP 500 Error == 254 254 255 -{{code language="none"}} 256 -HTTP Status 500 - 53 +See [[XWiki Cannot Connect to MySQL>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.server-unreachable.WebHome]]. 257 257 258 -type Exception report 259 - 260 -message 261 - 262 -descriptionThe server encountered an internal error () that prevented it from fulfilling this request. 263 - 264 -exception 265 - 266 -javax.servlet.ServletException: com.xpn.xwiki.XWikiException: Error number 3 in 0: Could not initialize main XWiki context 267 -Wrapped Exception: Error number 3001 in 3: Cannot load class com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager from param xwiki.store.migration.manager.class 268 -Wrapped Exception: Error number 0 in 3: Exception while hibernate execute 269 -Wrapped Exception: Could not create a DBCP pool. There is an error in the hibernate configuration file, please review it. 270 - 271 -root cause 272 - 273 -com.xpn.xwiki.XWikiException: Error number 3 in 0: Could not initialize main XWiki context 274 -Wrapped Exception: Error number 3001 in 3: Cannot load class com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager from param xwiki.store.migration.manager.class 275 -Wrapped Exception: Error number 0 in 3: Exception while hibernate execute 276 -Wrapped Exception: Could not create a DBCP pool. There is an error in the hibernate configuration file, please review it. 277 -{{/code}} 278 - 279 -In this case, try to disable **skip-networking** in MySQL *.ini file. Thanks a lot //M Rawash// (see his comment below). 280 - 281 281 == Unknown database 'xwiki' == 282 282 283 - Ifyougetthe following error:57 +See [["Unknown database" MySQL Error>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.unknown-database.WebHome]]. 284 284 285 -{{code language="none"}} 286 -Caused by: class com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'xwiki' 287 - at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 288 - at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) 289 - at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 290 - at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 291 - at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) 292 - at com.mysql.jdbc.Util.getInstance(Util.java:383) 293 - at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062) 294 - at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226) 295 - at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158) 296 - at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615) 297 - at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776) 298 - at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834) 299 - at com.mysql.jdbc.ConnectionImpl.setCatalog(ConnectionImpl.java:5456) 300 - at org.apache.commons.dbcp.DelegatingConnection.setCatalog(DelegatingConnection.java:374) 301 - at org.apache.commons.dbcp.DelegatingConnection.setCatalog(DelegatingConnection.java:374) 302 - at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setCatalog(PoolingDataSource.java:333) 303 - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 304 - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 305 - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 306 - at java.lang.reflect.Method.invoke(Method.java:606) 307 - at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:74) 308 - at com.sun.proxy.$Proxy47.setCatalog(Unknown Source) 309 - at com.xpn.xwiki.store.XWikiHibernateBaseStore.setDatabase(XWikiHibernateBaseStore.java:729) 310 - at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:911) 311 - at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:843) 312 - at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:830) 313 -... 314 -{{/code}} 315 - 316 -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. 317 - 318 -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}}). 319 - 320 -If this is the case [[you need to tell XWiki that you're using a different schema by setting the ##xwiki.db## configuration property>>Documentation.AdminGuide.Configuration#HConfigurethenamesofdatabaseschemas]]. 321 - 322 322 == MySQLSyntaxErrorException: Row size too large (> 8126) == 323 323 324 - ifyougetthefollowingerror:61 +See [["Row size too large" MySQL Error>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.row-size-limit.WebHome]]. 325 325 326 -{{code language="none"}} 327 -MySQLSyntaxErrorException: Row size too large (> 8126). 328 -Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. 329 -In current row format, BLOB prefix of 768 bytes is stored inline. 330 -{{/code}} 331 - 332 -When you are using a MySQL Server 5.6.20 you can get a "row size too large error." 333 -In the release notes, it is explained that a innodb_log_file_size which is too small will trigger a "Row size too large error." 334 - 335 -You can solve the problem by changing the innodb_log_file_size in the my.ini text file. 336 -Find more details in the link below. 337 -http://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-20.html
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -16,7 +16,7 @@ 16 16 17 17 * [[Configure HSQLDB>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-hsqldb.WebHome]], which runs embedded and is meant for evaluation rather than production. 18 18 * [[Configure MariaDB>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mariadb.WebHome]]. 19 -* [[MySQL>> Documentation.AdminGuide.Installation.InstallationWAR.InstallationMySQL.WebHome]].19 +* [[Configure MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]. 20 20 * [[Configure PostgreSQL Manually>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-postgresql-manually.WebHome]], or [[Configure PostgreSQL for XWiki in Docker>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-postgresql-docker.WebHome]]. 21 21 * [[Configure Oracle Manually>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-oracle-manually.WebHome]], [[Configure Oracle for XWiki in Docker>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-oracle-docker.WebHome]], or [[Configure Oracle in a Virtual Machine>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-oracle-vm.WebHome]]. 22 22
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. EleniCojocariu1 +XWiki.elenicojocariu - Content
-
... ... @@ -6,4 +6,4 @@ 6 6 * Persistence: data is written to disk periodically rather than on commit, so an undersized heap or an abrupt stop affects durability as well as stability. 7 7 * Operational tooling: HSQLDB has no built-in backup, live replication or administration tooling comparable to a production-oriented database, so those have to be covered by your own procedures. 8 8 9 -For production, use [[MariaDB>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mariadb.WebHome]], [[PostgreSQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-postgresql-manually.WebHome]] or [[MySQL>> Documentation.AdminGuide.Installation.InstallationWAR.InstallationMySQL.WebHome]] instead.9 +For production, use [[MariaDB>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mariadb.WebHome]], [[PostgreSQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-postgresql-manually.WebHome]] or [[MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]] instead.
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,7 +1,7 @@ 1 1 The command that dumps and restores an XWiki database is the database's own, and it differs for each of the [[supported databases>>dev:Community.SupportStrategy.DatabaseSupportStrategy]]. The examples below use the default database name ##xwiki##. 2 2 3 3 |=Database|=Dump|=Restore 4 -|[[MariaDB>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mariadb.WebHome]] and [[MySQL>> Documentation.AdminGuide.Installation.InstallationWAR.InstallationMySQL.WebHome]]|(((4 +|[[MariaDB>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mariadb.WebHome]] and [[MySQL>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]]|((( 5 5 {{code language="bash"}} 6 6 mysqldump -u root -p --add-drop-database --databases xwiki > xwiki.sql 7 7 {{/code}}
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -75,7 +75,7 @@ 75 75 Install and configure the database you wish to use: 76 76 77 77 * [[Configure HSQLDB>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-hsqldb.WebHome]] 78 -* [[MySQL Installation>>Documentation.AdminGuide.Installation.InstallationWAR.InstallationMySQL]]78 +* [[Configure MySQL>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]] 79 79 * [[MariaDB Installation>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mariadb.WebHome]] 80 80 * [[PostgreSQL Installation>>Documentation.AdminGuide.Installation.InstallationWAR.InstallationPostgreSQL]] 81 81 * [[Oracle Installation>>Documentation.AdminGuide.Installation.InstallationWAR.InstallationOracle]]
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -219,7 +219,7 @@ 219 219 220 220 === MySQL === 221 221 222 -See [[MySQL Installation>>Documentation.AdminGuide.Installation.InstallationWAR.InstallationMySQL||anchor="HTroubleshooting"]] for generic MySQL related issues.222 +See [[Configure MySQL>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]] for generic MySQL related issues. 223 223 224 224 === PostgreSQL === 225 225
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -14,7 +14,7 @@ 14 14 15 15 = Installation Steps = 16 16 17 -In general you should follow the instructions for [[installing MySQL>> InstallationMySQL]] since MariaDB is supposed to be a drop-in replacement for MySQL.17 +In general you should follow the instructions for [[installing MySQL>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.WebHome]] since MariaDB is supposed to be a drop-in replacement for MySQL. 18 18 19 19 Here are the differences with the MySQL installation: 20 20
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. ThomasMortagne1 +XWiki.elenicojocariu - Content
-
... ... @@ -16,7 +16,7 @@ 16 16 17 17 Instructions depending on the database you use: 18 18 19 -* [[MySQL/MariaDB>> Documentation.AdminGuide.Installation.InstallationWAR.InstallationMySQL.WebHome||anchor="HIndexes"]]19 +* [[MySQL/MariaDB>>documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.optional-indexes.WebHome]] 20 20 * [[Oracle>>Documentation.AdminGuide.Installation.InstallationWAR.InstallationOracle.WebHome||anchor="HIndexes"]] 21 21 22 22 = Sanity Checks =
Summary
-
Page properties (4 modified, 0 added, 0 removed)
-
Objects (0 modified, 1 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +Page Administration - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. XWikiGuest1 +XWiki.elenicojocariu - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Hidden
-
... ... @@ -1,1 +1,1 @@ 1 - false1 +true - Content
-
- XWiki.PinnedChildPagesClass[0]
-
- Pinned child pages
-
... ... @@ -1,0 +1,1 @@ 1 +storage-engine-character-set/ convert-database-utf8mb4/ convert-myisam-tables-innodb/ optional-indexes/ server-unreachable/ unknown-database/ server-timezone-unrecognized/ max-allowed-packet/ row-size-limit/
Eleni Cojocariu