Export a MySQL database from console
In this post we will see something extremely necessary and important when making backups of MySQL databases. When you have an application in this database engine, it is usually a recurring task to periodically take a complete copy of the database in case of any disaster. With the following command you can obtain a complete copy of your database that includes the creation script of the tables and all the information in it.
mysqldump -u user -p database > file.sql
Remember that you must replace user
and database
according to the user you are going to authenticate with and the database you want to export. The export will be saved in the file file.sql in the current directory. Do not forget to take a look at our article Connecting to MySQL by Terminal where you will discover different ways to connect to the MySQL console. See you next time.