Line 345: |
Line 345: |
| echo "SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;') FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' AND table_schema = 'zabbixdb';" |mysql105 -s|mysql105 zabbixdb | | echo "SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;') FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' AND table_schema = 'zabbixdb';" |mysql105 -s|mysql105 zabbixdb |
| </syntaxhighlight> | | </syntaxhighlight> |
− | * fix collation | + | * fix collation, for the issue "[Z3005] query failed: [1071] Specified key was too long; max key length is 3072 bytes [create index items_1 on items (hostid,key_(1021))]" [https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/401826-database-upgrade-failed-specified-key-was-too-long-max-key-length-is-3072-bytes see here.]<syntaxhighlight lang="bash"> |
− | <syntaxhighlight lang="bash">
| + | echo "SELECT CONCAT('ALTER TABLE ',TABLE_SCHEMA,'.',TABLE_NAME,' CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;') FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'zabbixdb';" |mysql105 -s |mysql10 |
− | echo "alter database $(config getprop zabbix-server DbName) character set utf8mb4 collate utf8mb4_bin;" |mysql105
| |
− | wget https://www.zabbix.com/documentation/current/assets/en/manual/appendix/install/utf8mb4_convert.sql
| |
− | cat utf8mb4_convert.sql |mysql105 `config getprop zabbix-server DbName`
| |
− | echo "SET @ZABBIX_DATABASE = '$(config getprop zabbix-server DbName)'; \ | |
− | set innodb_strict_mode = OFF; \
| |
− | CALL zbx_convert_utf8(); \
| |
− | set innodb_strict_mode = ON; \
| |
− | drop procedure zbx_convert_utf8;"|mysql105 `config getprop zabbix-server DbName`
| |
| </syntaxhighlight> | | </syntaxhighlight> |
| * fix the table with database/mysql/double.sql<syntaxhighlight lang="mysql"> | | * fix the table with database/mysql/double.sql<syntaxhighlight lang="mysql"> |
| cat /usr/share/doc/zabbix-server-mysql-5.0.30/double.sql |mysql105 `config getprop zabbix-server DbName` | | cat /usr/share/doc/zabbix-server-mysql-5.0.30/double.sql |mysql105 `config getprop zabbix-server DbName` |
| + | </syntaxhighlight> |
| + | * fix the foreign key for the issue "[Z3005] query failed: [1091] Can't DROP FOREIGN KEY `c_items_1`; check that it exists [alter table items drop foreign key c_items_1]" [https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/402412-zabbix-4-4-8-to-5-0-upgrade-failure see here]<syntaxhighlight lang="bash"> |
| + | echo "ALTER TABLE items ADD CONSTRAINT c_items_1 FOREIGN KEY (hostid) REFERENCES hosts (hostid) ON DELETE CASCADE; |
| + | CREATE INDEX items_1 ON items (hostid);" |mysql105 zabbixdb |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
Line 367: |
Line 363: |
| rpm -e --nodeps zabbix-web-mysql zabbix-web smeserver-zabbix-server | | rpm -e --nodeps zabbix-web-mysql zabbix-web smeserver-zabbix-server |
| yum install smeserver-zabbix-server-z50 --enablerepo=smecontribs,smetest,smedev | | yum install smeserver-zabbix-server-z50 --enablerepo=smecontribs,smetest,smedev |
| + | </syntaxhighlight> |
| + | ** fix collation after install |
| + | <syntaxhighlight lang="bash"> |
| + | echo "alter database $(config getprop zabbix-server DbName) character set utf8mb4 collate utf8mb4_bin;" |mysql105 |
| + | wget https://www.zabbix.com/documentation/current/assets/en/manual/appendix/install/utf8mb4_convert.sql |
| + | cat utf8mb4_convert.sql |mysql105 `config getprop zabbix-server DbName` |
| + | echo "SET @ZABBIX_DATABASE = '$(config getprop zabbix-server DbName)'; \ |
| + | set innodb_strict_mode = OFF; \ |
| + | CALL zbx_convert_utf8(); \ |
| + | set innodb_strict_mode = ON; \ |
| + | drop procedure zbx_convert_utf8;"|mysql105 `config getprop zabbix-server DbName` |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |