Backup, Restore MySQL Database or Migrate the software to a new server

Backing up your database is always recommended before any major changes or password resets. Migration to a new server also requires a backup and restore of the db

Backup Options:

  • VM -  Take Snapshot

  • Manually backup your database with Mysqldump command

Stop appserver/webserver 

Use Mysqldump to Backup/Export All Databases:

Set the CLI environment with these commands


Windows: 

cmd prompt> oware 

Linux: 

 environment is set at CLI login

Copy/Backup  Database with these commands:

cmd prompt> mysqldump -uroot -pdorado --single-transaction --all-databases --triggers --routines --events >all_databases.sql

Restore ALL databases:

Windows: 

cmd prompt> oware 

Linux: 

 environment is set at CLI login


cmd prompt> mysql -u root --password=dorado < all_databases.sql

cmd prompt> dbpostinstall

 

Migrating to a new Server

 If migrating to another server  or to an alternate Operating system, the target system MUST be on the same software version as the exported Db.

General Steps:

  1. Backup the source CruzOC DB 
  2. On new server install the exact same version of CruzOC as the one installed  for source DB 
  3. Restore the DB from Step 1 to the new server installation of CruzOC

NOTE: Linux to Windows migrations

If  changing  OS from Linux to Windows or Windows to Linux there can be issues with case sensitivity on the table name. Linux is case sensitive  and Windows is not.

For a detail explanation refer to this link. 

Here are some references to set up a cron jobs to automate your backups.

Backing up MySQL Database using mysqldump & crontab Windows

The Beginners Guide To Cron Jobs