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
Windows or Linux aut0mated backups
There is is a seeded action script called "Backup MySQL Database" that can be executed manually or scheduled. The Action takes the following parameters:
Number of backups is required: Set the number of backups to retain. The oldest will be deleted when the number of files is exceeded.
File path for the backups: Set the LOCAL directory where database files will be stored. NOTE: This will consume hard drive space and may impact the applications DB. Best practice to archive these files on a separate system and delete them from the local server.
Root Password: This is the default root password for the DB if unchanged it is "dorado". Best Practice to change the root password.
When the script completes, there will be 7 zipped Db files. They will need to be unzipped for the Db Restore.
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
Restore the files created from Action "Backup MySQL Database" :
Once the files are unzipped they can be restored with the same command syntax and process as "Restore ALL databases" For example:
cmd prompt> mysql -u root --password=dorado < synergy.sql
cmd prompt> mysql -u root --password=dorado < owbusdb.sql
If performing a full restore, all unzipped files from "Backup MySQL Database" should be restored.
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:
- Backup the source CruzOC DB
- On new server install the exact same version of CruzOC as the one installed for source DB
- 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