Export a MySQL database from console

Author
By Darío Rivera
Posted On in MySQL

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.


Acerca de Darío Rivera

Author

Application Architect at Elentra Corp . Quality developer and passionate learner with 10+ years of experience in web technologies. Creator of EasyHttp , an standard way to consume HTTP Clients.

LinkedIn Twitter Instagram

Sólo aquellos que han alcanzado el éxito saben que siempre estuvo a un paso del momento en que pensaron renunciar.