Backup mysql with create schema

0

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

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

I researched and found this command but it only backs up the tables and data.

mysqldump -h HOST -u LOGIN -pSENHA --opt --routines --triggers BANCO > backup.sql
    
asked by anonymous 22.02.2016 / 17:54

1 answer

1

The mysqldump command not only backs up the data but also the Bank. It has several options that generate the outputs you need, such as --create-options , --add-drop-table and --add-drop-database Na 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]
    
23.02.2016 / 18:50