Today we will see how you can export the database from SSH. This can be useful in situations like moving your site, as it can help you to export the entire database, or need to upgrade a website.
Generate a Database Backup:
Step 1: Connect to your server via SSH.
Step 2: In the command line enter the following code:
mysqldump -u dbusername -p databasename > nameofdbbackup.sql
Make sure you replace:
dbusername = with the database username for the database you want to export.
databasename = with the name of the database you want to export.
nameofdbbackup = enter a name for the exported database.
Step 3: Once you Press the Enter key, it will ask you for your password. Provide your password and press Enter key again, the exporting process will begin. It may take some time to complete the process, depending on the size of your database. The SSH client will take you to the new line when this process is completed and the database will now be available for download in your home directory.