Migrate ZM installation

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

Migrate ZM installation

Post 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
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Migrate ZM installation

Post 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)
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: 2931
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Migrate ZM installation

Post 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
Markymark
Posts: 50
Joined: Fri Jan 03, 2014 7:43 am

Re: Migrate ZM installation

Post 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
bbunge
Posts: 2931
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Migrate ZM installation

Post 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.
Markymark
Posts: 50
Joined: Fri Jan 03, 2014 7:43 am

Re: Migrate ZM installation

Post 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
bbunge
Posts: 2931
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Migrate ZM installation

Post by bbunge »

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 »

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
Locked