lightguy48 wrote: ↑Sat Mar 04, 2023 10:34 pm
Fixed!! Thanks!
I dumped the db, went in and searched the dump file and found two instances of the debian-sys-maint and replaced them with zmuser
Reloaded the DB and all good, thanks!
Thanks, this seemed to help.
- I've traced the issue back to the day where I moved my whole ZM instance from physical host onto brand new VM, while re-importing the database from a instance that I was using for years. Where did the debian default user came from, I have no idea. What is funny that the ZM seemed to have been recording and creating events, while in fact it was not. Which was only noticed after zero-sized backups. Which were noticed after significant drop on space used. Which was noticed by total accident.
Here are my notes. Obviously use at you own risk and create VM snapshot/backup somewhere else than /tmp; adjust accordingly with you db name and user.
Export db
mysqldump -u zmuser -p zm > /tmp/zmdump.sql
Verify the issue
cat /tmp/zmdump.sql | grep debian-sys-maint
Code: Select all
root@zoneminder:~# cat /tmp/zmdump.sql | grep debian-sys-maint
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER event_insert_trigger AFTER INSERT ON Events
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER event_update_trigger AFTER UPDATE ON Events
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER event_delete_trigger BEFORE DELETE ON Events
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Events_Day_update_trigger AFTER UPDATE ON Events_Day
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Events_Day_delete_trigger BEFORE DELETE ON Events_Day
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Events_Hour_update_trigger AFTER UPDATE ON Events_Hour
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Events_Hour_delete_trigger BEFORE DELETE ON Events_Hour
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Events_Month_update_trigger AFTER UPDATE ON Events_Month
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Events_Month_delete_trigger BEFORE DELETE ON Events_Month
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Events_Week_update_trigger AFTER UPDATE ON Events_Week
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Events_Week_delete_trigger BEFORE DELETE ON Events_Week
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Zone_Insert_Trigger AFTER INSERT ON Zones
/*!50003 CREATE*/ /*!50017 DEFINER=`debian-sys-maint`@`localhost`*/ /*!50003 TRIGGER Zone_Delete_Trigger AFTER DELETE ON Zones
cat /tmp/zmdump.sql | grep zmuser
Do in-place replace of debian-sys-maint with zmuser using sed
sed -i 's/debian-sys-maint/zmuser/g' /tmp/zmdump.sql
Verify if fixed
cat /tmp/zmdump.sql | grep debian-sys-maint
cat /tmp/zmdump.sql | grep zmuser
Drop old db and create new one, NOTE: if the user exists already, it will fail.
first open db console via mariadb command
DROP DATABASE zm;
CREATE DATABASE zm;
CREATE USER zmuser@localhost IDENTIFIED BY 'zmpass';
GRANT ALL ON zm.* TO zmuser@localhost;
FLUSH PRIVILEGES;
exit;
Put fixed database back
mysql -u zmuser -p zm < /tmp/zmdump.sql
Clean up after you are sure you don't need the export anymore, otherwise /tmp gets wiped with each reboot
rm /tmp/zmdump.sql