Export and import dump file from MySql inside console


If you want to create a dump file of a mysql database you can use the mysqldump command which is part of the mysql installation. This great utility can perform a backups of your mysql database, producing a set of SQL statements that can be executed to reproduce the original database table data.

Open your terminal or command prompt and run the following command to create a mysql backup file from the selected database.

mysqldump -u mysql_user -p DATABASE_NAME > backup.sql

Note: You have to grants all privileges to mysql_user before performing mysqldump.

To import the backup you can perform the following command:

mysql -u mysql_user -p DATABASE < backup.sql

This is just a simple example. You find more information aout mysqldump at https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html