KBEC-00246 - MySQL Commands

Article ID:360033191951
1 minute readKnowledge base

Use the following commands to create and restore database dumps if you are using the local MySQL installation provided with CloudBees CD (CloudBees Flow). If you are using your own version of MySQL, the commands should still work, although you may need to make modifications.

Notes

  • On Linux, your LD_LIBRARY_PATH must be set up correctly to run the command-line tools. In this case, source the bash.profile or csh.profile script located in the install directory (for example, /opt.electriccloud/electriccommander/bash.profile).

  • The commands use the default user name, password, and database name (all commander), as well as the default data directory on a Linux system. If you have used any non-default values, update the command accordingly.

  • As of CloudBees CD (CloudBees Flow) v.4.2.0, MySQL database is no longer bundled with the product.

Creating a Database Dump

Call mysqldump (located in the mysql/bin subdirectory in the install directory) with the following arguments:

On Linux
--single-transaction --user=commander --password=commander --result=commanderBackup.sql --socket=/opt/electriccloud/electriccommander/mysql/mysql.sock commander
On Windows
--single-transaction --user=commander --password=commander --result=commanderBackup.sql commander

Restoring a Database Dump

Call mysql (located in the mysql/bin subdirectory of the install directory) with the following arguments:

On Linux
--user=commander --password=commander --socket=/opt/electriccloud/electriccommander/mysql/mysql.sock commander < commanderBackup.sql
On Windows
--user=commander --password=commander commander < commanderBackup.sql

Modifying the Data to Disable Schedules and Resources

Call mysql (located in the mysql/bin subdirectory in the install directory) with the following arguments:

On Linux
--user=commander --password=commander --socket=/opt/electriccloud/electriccommander/mysql/mysql.sock
On Windows
--user=commander --password=commander

Then run the following commands:

use commander;
update ec_schedule set disabled = 1;
update ec_resource set disabled = 1;