How to Export a MySQL Database using Command Line

In this tutorial, we are going to see how to export a MySQL database using Command Line. mysqldump command is used to export databases to SQL text files, which makes transferring and moving them relatively easy. You will need the name of the database as well as the username and password with privileges to at least full read-only access.


How to Export a MySQL Database using Command Line

You can export your database by using the following command:

mysqldump -u username -p db_name > file.sql
  • username : Username with which you connect to the database
  • db_name : Name of the database that will be exported
  • file.sql : the SQL file in which the output will be saved

If any errors occur during the export process, mysqldump will display them clearly on the screen.
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

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