Page 1 of 1

Migrate ZM installation

Posted: Mon Mar 14, 2016 2:43 pm
by Markymark
Hi,

after struggling to upgrade my Debian installation from Wheezy to Jessie prior to upgrade ZM from 1.28 to 1.29 I decided to start with a fresh Ubuntu Trusty / ZM 1.29 installation. Having a carefully tuned ZM installation up and running I would like to migrate the database / settings from the old installation. I thought about the following steps:

1. dump database (mysqldump)
2. transfer dump to new server
3. import database
4. run zmupdate.pl

Could somebody please confirm that this is - basically - the way to go?

Any hint apprechiated.

Regrds,

Mark

Re: Migrate ZM installation

Posted: Mon Mar 14, 2016 5:01 pm
by knight-of-ni
5. Examine Options -> Paths and verify every value shown is appropriate for Ubuntu Trusty, particularly PATH_ZMS (see "easy way" documentation)

Re: Migrate ZM installation

Posted: Mon Mar 14, 2016 9:04 pm
by bbunge
That is what I did but from Ubuntu 14.04 to Centos 7. After you run the database upgrade make sure you do the permissions for MySQL. See the WIKI for instructions.

bb

Re: Migrate ZM installation

Posted: Tue Mar 15, 2016 9:20 am
by Markymark
Thanks so far!

Regarding step 3 (import database):

I dumped the database (mysqldump -u root -p zm > zm.sql) on the old system and installed LAMP and ZM on the new system. According to the documentation the next step would be to create the database and 'zmuser':

Code: Select all

sudo mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
My approach would be to skip both steps and import the old database instead:

Code: Select all

mysql -uroot -p zm < /path/to/zm.sql
Will this do the trick?

Rgrds,

Mark

Re: Migrate ZM installation

Posted: Tue Mar 15, 2016 11:57 am
by bbunge
Looks right if you are sure of your commands. I have to admit that I used Webmin to import the zm dump of the old installation. I created an empty database called zm then ran the sql dump file, went to a command prompt and ran the zm upgrade and then the permissions string. Make sure you have added innodb_file_per_table to my.cnf then restart MySQL before you add your zm database.

Re: Migrate ZM installation

Posted: Tue Mar 15, 2016 5:02 pm
by Markymark
@bbunge & knnniggett,

many thanks for your recommendations. ZM runs like a charm again. Regarding the database migration I used the following steps:

Dump database on old system: mysqldump -u root -p zm > zm.sql
Create db on new system: mysql -uroot -p -e "CREATE DATABASE zm;"
(Create 'zmuser' according to wiki & docs.)
Import db from old system: mysql -uroot -p zm < /mnt/zm.sql
Update db: zmupdate.pl (without any options)

Pretty easy! :D

Rgrds,

Mark

Re: Migrate ZM installation

Posted: Tue Mar 15, 2016 8:54 pm
by bbunge
But... did you do:

mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"

Re: Migrate ZM installation

Posted: Wed Mar 16, 2016 5:36 am
by Markymark
Yes, I did this right after I imported the db. I skiped this step in the list above because it is not specific with respect to the migration of the db. But it is a good idea to make this clear.

Greetings

Mark