Migrate ZM installation

Forum for questions and support relating to the 1.29.x releases only.
Post Reply
Markymark
Posts: 50
Joined: Fri Jan 03, 2014 7:43 am

Migrate ZM installation

Post by Markymark » Mon Mar 14, 2016 2:43 pm

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

User avatar
knight-of-ni
Posts: 2332
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Migrate ZM installation

Post by knight-of-ni » Mon Mar 14, 2016 5:01 pm

5. Examine Options -> Paths and verify every value shown is appropriate for Ubuntu Trusty, particularly PATH_ZMS (see "easy way" documentation)
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/

bbunge
Posts: 2706
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Migrate ZM installation

Post by bbunge » Mon Mar 14, 2016 9:04 pm

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

Markymark
Posts: 50
Joined: Fri Jan 03, 2014 7:43 am

Re: Migrate ZM installation

Post by Markymark » Tue Mar 15, 2016 9:20 am

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

bbunge
Posts: 2706
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Migrate ZM installation

Post by bbunge » Tue Mar 15, 2016 11:57 am

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.

Markymark
Posts: 50
Joined: Fri Jan 03, 2014 7:43 am

Re: Migrate ZM installation

Post by Markymark » Tue Mar 15, 2016 5:02 pm

@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

bbunge
Posts: 2706
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Migrate ZM installation

Post by bbunge » Tue Mar 15, 2016 8:54 pm

But... did you do:

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

Markymark
Posts: 50
Joined: Fri Jan 03, 2014 7:43 am

Re: Migrate ZM installation

Post by Markymark » Wed Mar 16, 2016 5:36 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest