I'm trying to upgrade my Zabbix Server today (MariaDB). Current version is 4.4, I want to update it to 5.0
Installation went well. When I start the zabbix-server process, the database starts upgrading, and it then stops with the following error message
[Z3005] query failed: [1025] Error on rename of './zabbix/items' to './zabbix/#sql2-6a6-347' (errno: 152) [alter table items drop foreign key c_items_1]
3891:20200525:110755.747 database upgrade failed
Im trying connect to MySQL and run command:
alter table items ADD CONSTRAINT `c_items_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE
And have error:
#1025 - Error on rename of './zabbix/#sql-6a6_2b9' to './zabbix/items' (errno: 150)
What to do with it?
The situation was decided by creating a key constraint c_items_1
. The first time I created a query:
alter table items ADD CONSTRAINT `c_items_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE
But I made a mistake in REFERENCES. Having looked at the key restrictions in the backup database, I received a request
alter table items ADD CONSTRAINT `c_items_1` FOREIGN KEY (`hostid`) REFERENCES `zabbix`.`hosts` (`hostid`) ON DELETE CASCADE ON UPDATE RESTRICT;
Thank for help!