It's very important to backup your database periodically and exist a very simple command called
mysqldump that you can use to create a backup in a sql file as follows:
mysqldump -u userName -p databaseName > outputFileName.sql
After that a command will prompt for the password of the database user.
You have created a backup of your DB. You can create a cronjob to backup your database daily, weekly, etc.