Skip to main content
OnCommand Insight

Moving MySQL data using the command line

Contributors

You can use migrate MySQL data directory to a different directory. You can retain the current data directory. You can use the migrate option on the Troubleshooting menu or alternatively, you can use the command line. This procedure describes how to use the command line.

About this task

If you retain the current data directory, it will be kept as a backup and renamed.

You can use the Migrate MySQL Data utility or you can use a java -jar mysqldatamigrator.jar option in the OnCommand Insight path of \bin\mysqldatamigrator where the following parameters should be used:

  • Mandatory parameters

    • -path

      The new data path to which the data folder will be copied.

  • Optional parameters

    • -myCnf <my .cnf file>

      The path for the .cnf file. The default is <install path>\mysql\my.cnf. Use this flag only if a non-default MySQL is used.

    • -doBackup

      If this flag is set, the current data folder will be renamed but not deleted.

Steps

  1. Access the command line tool here: <installation path> \bin\mysqldatamigrator\mysqldatamigrator.jar``

Example usage

java -jar mysqldatamigrator.jar -path "C:\<new path>" -doBackup