Mysql backup with create schema

Asked

Viewed 72 times

0

I need to do the backup from a database (DUMP) that comes with create schema.

Which command line using PUTTY (via SSH) to do such a task ?

I searched and found this command but it only backup tables and data.

mysqldump -h HOST -u LOGIN -pSENHA --opt --routines --triggers BANCO > backup.sql

1 answer

1


The command mysqldump not only backup the data but also the database structure. It has several options that generate the output you need, for example --create-options, --add-drop-table and --add-drop-database In the official documentation you can find all the options and their descriptions.

Remember: To perform a backup use the following command:

$ mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]

To restore the backup use the command below:

mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.