To backup a database, it is pretty easy. Here are the 2 commands I use most
If you are planning on restoring this into a new empty database, then use this command.
mysqldump --add-drop-table -u db_username -p db_name > mybackup.sql
If you are planning on merging this backup into an existing database, then you should remove the –add-drop-table command. So it should look like this.
mysqldump -u db_username -p db_name > mybackup.sql
db_username is the username of your database
db_name is the name of your database
The -p will prompt you for the database password after you execute the command
Change mybackup.sql to whatever you want to name the backup file of your database. Typically, I’ll name it the same name as the database.