How to import and export data base from Mysql

To import and export a MySQL database, you can use the command-line tool called mysqldump. This tool allows you to create a backup of a database, which can then be imported or exported to/from another MySQL server.

Here’s how you can import and export a database using mysqldump:

Export/Backup a MySQL Database:

  1. Open a terminal or command prompt.
  2. Navigate to the location where you want to save the backup file (e.g., cd /path/to/backup/folder).
  3. Use the following command to export the database to a SQL file:

Import Mysql Database
$ mysql -u USERNAME -p DB_NAME < import_file.sql
Password:

Export Mysql Database
$ mysqldump -u USERNAME -p DB_NAME > exported.sql
Password:

That’s it! You have successfully imported/exported a MySQL database using mysqldump.

Leave a Reply

Your email address will not be published. Required fields are marked *