Mysqldump Question

I am trying to reset a large database using the mysqldump command. I would like to avoid the "use database" command in the generated sql file. This is because I want to create the same database with a different name. Since the size of the sql file is large, I cannot open the sql file and edit it.

I tried --no-create-db, but still I get the use command in the dump file

Please, help.

+5
source share
5 answers

You may have used something like this:

mysqldump -u -p <other options> --database your_database > file.sql

I found that when using --databaseit, a script is created using the string 'use your_database'. Thus, do not use this option, and the line is gone:

mysql -u -p <other options> your_database > file.sql
+9
source

, , Linux, sed ( perl/python) "use".

+1

- mysqldump . , mysqldump -u user -p --tables databasename. USE.

+1

All Articles