Line 343: |
Line 343: |
| | | |
| </syntaxhighlight> | | </syntaxhighlight> |
| + | * fix ENGINE if forgotten before |
| + | <syntaxhighlight lang="bash"> |
| + | 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> |
| + | * fix collation |
| + | <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> |
| + | * fix the table with database/mysql/double.sql |
| + | cat /usr/share/doc/zabbix-server-mysql-5.0.30/double.sql |mysql105 `config getprop zabbix-server DbName` |
| * install 5.0 using rpms<syntaxhighlight lang="bash"> | | * install 5.0 using rpms<syntaxhighlight lang="bash"> |
| db yum_repositories setprop zabbix44 status disabled | | db yum_repositories setprop zabbix44 status disabled |
Line 354: |
Line 371: |
| * fix the table with database/mysql/double.sql | | * fix the table with database/mysql/double.sql |
| <syntaxhighlight lang="mysql"> | | <syntaxhighlight lang="mysql"> |
− | USE zabbixdb;
| + | cat /usr/share/doc/zabbix-server-mysql-5.0.30/double.sql |mysql105 `config getprop zabbix-server DbName` |
− | ALTER TABLE trends
| |
− | MODIFY value_min DOUBLE PRECISION DEFAULT '0.0000' NOT NULL,
| |
− | MODIFY value_avg DOUBLE PRECISION DEFAULT '0.0000' NOT NULL,
| |
− | MODIFY value_max DOUBLE PRECISION DEFAULT '0.0000' NOT NULL;
| |
− | ALTER TABLE history MODIFY value DOUBLE PRECISION DEFAULT '0.0000' NOT NULL;
| |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
Line 367: |
Line 379: |
| mysqldump `config getprop zabbix-server DbName` > zabbixdb.sql | | mysqldump `config getprop zabbix-server DbName` > zabbixdb.sql |
| echo "CREATE DATABASE IF NOT EXISTS `config getprop zabbix-server DbName` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"| mysql105 | | echo "CREATE DATABASE IF NOT EXISTS `config getprop zabbix-server DbName` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"| mysql105 |
− | mysql105 `config getprop zabbix-server DbName`< zabbixdb.sql | + | cat zabbixdb.sql |sed 's/ENGINE=MyISAM/ENGINE=InnoDB/g'|mysql105 `config getprop zabbix-server DbName` |
| | | |
| echo "CREATE USER IF NOT EXISTS `config getprop zabbix-server DbUser`@localhost IDENTIFIED BY '`config getprop zabbix-server DbPassword`';"| mysql105 | | echo "CREATE USER IF NOT EXISTS `config getprop zabbix-server DbUser`@localhost IDENTIFIED BY '`config getprop zabbix-server DbPassword`';"| mysql105 |