mysql - How to avoid "use <database>" statement on mysqldump backups? -
i'm using command syntax :
mysqldump -u<username> -p<password> --no-create-db --databases mydatabase > /var/backups_db/mydatabase-$(date +"%d-%m-%y-%h:%m:%s").sql
but not find how prevent line "use mydatabase" inserted in generated file. option should use?
tia.
as @wchiquito said in comments, in order avoid have "use databasename
" statement in dump file must remove --databases
option.
if don't have choice, can remove afterwards using unix sed command :
cat sourcefile.sql | sed '/use `databasename`;/d' > destfile.sql
thomas
Comments
Post a Comment