<
From version < 26.1 >
edited by Guillaume Fenollar
on 2012/10/03
To version < 28.1 >
edited by Guillaume Fenollar
on 2012/10/03
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -12,28 +12,6 @@
12 12  If you use MySQL with default engine MyISAM, you will most likely corrupt your database.** We highly recommend using a storage engine such as InnoDB which supports transactions.
13 13  {{/warning}}
14 14  
15 -If you have a MyISAM database and wish to migrate to InnoDB you could use/adapt this script:
16 -
17 -{{code}}
18 -#!/bin/bash
19 -
20 -db=xwiki
21 -to_character_set=utf8
22 -to_collation=utf8_bin
23 -
24 -mysql_cmd="mysql -u root"
25 -
26 -TBL_LIST=$($mysql_cmd -N -s -r -e "use $db;show tables;")
27 -
28 -for tbl_name in $TBL_LIST;
29 -do
30 -$mysql_cmd -e "alter table $db.$tbl_name convert to character set $to_character_set collate $to_collation;"
31 -done
32 -
33 -echo "Here the result of the operation:"
34 -$mysql_cmd -e "USE $db;SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=DATABASE();"
35 -{{/code}}
36 -
37 37  == MySQL versions older than 5.0 ==
38 38  
39 39  XWiki does not fully work with MySQL versions 4.x or lower, due to several limitations of the way the SQL standards are implemented in MySQL, limited support for non-latin1 encodings, the flaky integration of Hibernate and MySQL 4, and other things. Most of the application works fine, but there are some parts that cannot be easily fixed, so if you must use MySQL 4.x, you're doing it on your own. Seriously, MySQL 4 is pretty old and buggy, you should consider upgrading.
... ... @@ -79,6 +79,7 @@
79 79  {{code language="none"}}
80 80  mysqld --console --max_allowed_packet=32M
81 81  {{/code}}
60 +Or you can modify directly the my.cnf configuration file to set this value permanently.
82 82  )))
83 83  {{/info}}
84 84  
... ... @@ -88,6 +88,64 @@
88 88  {{/info}}
89 89  )))
90 90  
70 += Tips =
71 +
72 +== Convert a database from latin1 (or collation utf8_ci) to utf8/utf8_bin ==
73 +
74 +{{code}}
75 +#!/bin/bash
76 +
77 +db=xwiki
78 +to_character_set=utf8
79 +to_collation=utf8_bin
80 +
81 +mysql_cmd="mysql -u root"
82 +
83 +TBL_LIST=$($mysql_cmd -N -s -r -e "use $db;show tables;")
84 +
85 +for tbl_name in $TBL_LIST;
86 +do
87 +$mysql_cmd -e "alter table $db.$tbl_name convert to character set $to_character_set collate $to_collation;"
88 +done
89 +
90 +echo "Here the result of the operation:"
91 +$mysql_cmd -e "USE $db;SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA=DATABASE();"
92 +{{/code}}
93 +
94 +== Convert from MyISAM to InnoDB ==
95 +
96 +{{code}}
97 +#!/bin/bash
98 +
99 +MYSQL_COMMAND=mysql
100 +TO_ENGINE=INNODB
101 +
102 +DATABASES=$(mysql -N -s -r -e 'show databases'|grep -v ^information_schema$|grep -v ^mysql$)
103 +
104 +
105 +for db in $DATABASES
106 +do
107 +
108 +echo "Working on database $db..."
109 +echo ""
110 +
111 +TABLES=$(mysql -N -s -r -e "show tables from $db;")
112 +
113 +for tb in $TABLES
114 +do
115 +
116 +$MYSQL_COMMAND -e "ALTER TABLE $db.$tb ENGINE = $TO_ENGINE;"
117 +
118 +done
119 +
120 +$MYSQL_COMMAND -e "SELECT table_name,Engine,table_collation FROM information_schema.tables WHERE table_schema = DATABASE();"
121 +
122 +echo ""
123 +echo ""
124 +
125 +done
126 +{{/code}}
127 +
91 91  = Troubleshooting =
92 92  
93 93  == Unable to login to MySQL Console ==

Get Connected