Is there a way to remove/change the USE databasename
from the .sql
file generated with mySqlDump
?
I'm useing the following commandline
bin/mysqldump.exe -uName -pPass --single-transaction --routines --triggers --host host_test.com --databases testreporting > backups/testreporting.sql
The part I want changed is the start
--
-- Current Database: `testreporting`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testreporting` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `testreporting`;
You have to remove --databases
https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#option_mysqldump_databases
--databases, -B Dump several databases. Normally, mysqldump treats the first name argument on the command line as a database name and following names as table names. With this option, it treats all name arguments as database names. CREATE DATABASE and USE statements are included in the output before each new database. This option may be used to dump the performance_schema database, which normally is not dumped even with the --all-databases option. (Also use the --skip-lock-tables option.) Note See the --add-drop-database description for information about an incompatibility of that option with --databases.