简体   繁体   中英

Mysql Backup with create schema

I am in need of backing up a data base (dump) that come with create schema. What is the command line using putty (via SSH) to do this job ? I researched and thought this command but it does only the tables backup and data.

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

Use the option --databases BANCO , ie

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

This will add create database (and drop database ) statements to the dump.

And in case you wonder: schema and database are synonymous in MySQL: Difference Between Schema / Database in MySQL .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM