One of the worst mistakes you can make is not having a backup of your database. When something goes wrong, you will be sorry. And the thing about backing up a database is that not everyone knows how to do it. There’s no simple drag and drop a copy and you’re done. Since there is an extra step involved, many people just skip the whole ordeal. Then they lose all of their data when a hard drive dies.
Here’s how you can make a backup of your MySQL database to keep yourself happy. A program called mysqldump comes with MySQL server, enter the command below:
mysqldump -u myusername -p -B mydatabase > thebackupfile.sql
And replace “myusername” with your database user’s name, “mydatabase” with your database name and “thebackupfile.sql” with whatever you want your back to be called. Now you can copy that file somewhere on a different machine to be extra safe from catastrophic data loss.
You can check out how to import the backup, also.