You can use the mysqldump command to back up your MySQL databases. The following command backs up all your MySQL databases.
# mysqldump -u root -p --opt --all-databases > /root/all-databases
In this case, all databases on the local system are copied to the file all-databases in the root directory. You can also use mysqldump to back up a single database, several databases, or tables within a database. Refer to the mysqldump man page for further information.