Last modified by superadmin on 2026/11/25 21:31

Show last authors
1 [[MySQL Storage Engine and Character Set>>doc:documentation.xs.admin.installation.install-relational-database.configure-mysql.storage-engine-character-set.WebHome]] explains why XWiki needs InnoDB.
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 )))

Get Connected