如何更改 mysqldump USE DATABASE
How to change mysqldump USE DATABASE
有没有办法从 mySqlDump
生成的 .sql
文件中 remove/change USE databasename
?
我正在使用以下命令行
bin/mysqldump.exe -uName -pPass --single-transaction --routines --triggers --host host_test.com --databases testreporting > backups/testreporting.sql
我要改的部分是开头
--
-- Current Database: `testreporting`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testreporting` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `testreporting`;
您必须删除 --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.
有没有办法从 mySqlDump
生成的 .sql
文件中 remove/change USE databasename
?
我正在使用以下命令行
bin/mysqldump.exe -uName -pPass --single-transaction --routines --triggers --host host_test.com --databases testreporting > backups/testreporting.sql
我要改的部分是开头
--
-- Current Database: `testreporting`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testreporting` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `testreporting`;
您必须删除 --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.