How to Create a mySQL Backup from Command Line

MySQL provides a great command line utility to take backups of your MySQL database. mysqldump command line utility is available with MySQL installation (bin directory) and can be used to achieve this.

  1. Login to your server with root user

  2. Use following command for taking backup of your MySQL database using mysqldump utility.

mysqldump –u[user name] –p[password] [database name] > [dump file]

Use following command for taking backup of your MySQL database using mysqldump utility.

  1. Now to make sure the command was executed and the backup file was created using the command

ls –l

on the same path and you should see the database backup file.

Confirm command was executed and the backup file was created use the command ls –l