Back up or restore remote/local MySQL databases with command line.
Tutorials
Automatic Backup Scheduler for MySQL > Tutorials > How to back up MySQL database with command line?

How to back up MySQL database with command line?


MySQL Backup Command Line Program can help you manually back up or restore remote/local MySQL databases without GUI. You can back up MySQL databases to a remote or local MySQL server, or to backup files. You can restore MySQL backup files to a remote or local MySQL databases. It ability to connect MySQL server by TCP/IP, SSL, SSH, Compression, Shared-Memory, Named Pipe, Socket protocols. You can add the commands to a batch file.

If you want to combine the MySQL backup function with some other function which the software does not have, please add the command line statements to a batch file. When you execute the batch file, all the commands in the batch file will be executed, and all the jobs will be run in your own schedule.

How to use command line statements to back up MySQL database:

Download and install the software.
Please download and install the software Automatic Backup Scheduler for MySQL.



  1. Runs under Windows 8/7/2008 Server/Vista/2003 Server/XP/2000 (32 bit and 64 bit).
  2. Supports MySQL from 4.0 to the latest version (MySQL 4.0, 4.1, 5.0, 5.1, 5.5, 5.6, 6.0, etc.).
  3. Supports MySQL servers run on all Operating Systems (Linux, UNIX, Windows, Ubuntu, etc.).

Please check the option Add application directory to your environmental path in the Setup Wizard.

Back up MySQL database by MySQL Backup Command Line Program.
Open the command prompt window and enter the full path of the installation folder, enter "mysqlbackup.exe" to use MySQL Backup Command Line Program.
MySQL Backup Command Line Program

Please enter --help to show the options of MySQL Backup Command Line Program.

Use commands as the following samples to back up or restore MySQL databases:
  1. mysqlbackup --from [CONNECTION OPTIONS] --to [CONNECTION OPTIONS] --database [DB]
  2. mysqlbackup --from [CONNECTION OPTIONS] --to --file [FILE PATH] --databases [DB1 DB2 ...]
  3. mysqlbackup --from --file [FILE PATH] --to [CONNECTION OPTIONS] --all-databases
For example:
mysqlbackup --from -h www.databasethink.com --port 3306 -u root -p admin --to --file "C:\Users\Administrator\Documents\databasethink.sql" --all-databases

Note:
  1. Please grant the user account enough privileges to access the remote MySQL database ( % or a specified IP address ).
  2. Please grant the user account enough rights to create files under the specified folder.


Create a batch file with MySQL backup command line statements.
  1. Create a file, save it as FILENAME.bat.
  2. Add the commands of some other function into the batch file.
  3. Add the commands of MySQL backup into the file.
  4. Add other needed commands into the file and save it.
That's all. When you execute the .bat file all the jobs will run in your own schedule.

Enjoy it now!




  1. Runs under Windows 8/7/2008 Server/Vista/2003 Server/XP/2000 (32 bit and 64 bit).
  2. Supports MySQL from 4.0 to the latest version (MySQL 4.0, 4.1, 5.0, 5.1, 5.5, 5.6, 6.0, etc.).
  3. Supports MySQL servers run on all Operating Systems (Linux, UNIX, Windows, Ubuntu, etc.).
Copyright © 2024 Database Think Software. All rights reserved.