Backing up your MySQL database using mysqldump

Question:  How to backup the MySQL database using mysqldump ?
How to login mysql in command lineAnswer:  mysqldump is a command line tool to backup the MySQL database. It backup and dump the database in .sql format .

Syntax:

#  mysqldump -u [DB_user] -p  [DB_name] > [DB_name.sql] 

Example:

#  mysqldump -u root -p  my_db  >  my_db.sql
Enter password: < Enter your mysql password here  >

To backup the remote mysql database

#  mysqldump  -u root -h [remote_DB_IP] -p  my_db > my_db.sql
Enter password: < Enter your mysql password here  >

For remote mysql database backup , make sure the user is granted permission to dump database from remote system..




Leave a Reply

Your email address will not be published. Required fields are marked *