Description:
Option --skip for mysqldbimport does not work.
How to repeat:
Try to skip grants:
sveta@thinkie:~/build/mysql-5.7/mysql-test> mysqldbimport --server=root:@127.0.0.1:13000 --skip-gtid --skip=grants mitest.sql --dryrun
WARNING: Using a password on the command line interface can be insecure.
# Source on 127.0.0.1: ... connected.
# Importing definitions from mitest.sql.
CAUTION: The following warning messages were included in the import file:
# WARNING: Using a password on the command line interface can be insecure.
# WARNING: A partial export from a server that has GTIDs enabled will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to generate the GTID statement, use the --skip-gtid option. To export all databases, use the --all and --export=both options.
DROP DATABASE IF EXISTS `test`
CREATE DATABASE `test`
USE `test`
CREATE TABLE `c1` (
`f1` varchar(255) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE `dsns` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) DEFAULT NULL,
`dsn` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
GRANT ALTER ON `test`.* TO ''@'%'
GRANT CREATE ON `test`.* TO ''@'%'
GRANT CREATE ROUTINE ON `test`.* TO ''@'%'
GRANT CREATE TEMPORARY TABLES ON `test`.* TO ''@'%'
GRANT CREATE VIEW ON `test`.* TO ''@'%'
GRANT DELETE ON `test`.* TO ''@'%'
GRANT DROP ON `test`.* TO ''@'%'
GRANT EVENT ON `test`.* TO ''@'%'
GRANT INDEX ON `test`.* TO ''@'%'
GRANT INSERT ON `test`.* TO ''@'%'
GRANT LOCK TABLES ON `test`.* TO ''@'%'
GRANT REFERENCES ON `test`.* TO ''@'%'
GRANT SELECT ON `test`.* TO ''@'%'
GRANT SHOW VIEW ON `test`.* TO ''@'%'
GRANT TRIGGER ON `test`.* TO ''@'%'
GRANT UPDATE ON `test`.* TO ''@'%'
USE `test`
#...done.
Nothing skipped!
Same for tables:
sveta@thinkie:~/build/mysql-5.7/mysql-test> mysqldbimport --server=root:@127.0.0.1:13000 --skip-gtid --skip=tables mitest.sql --dryrun
WARNING: Using a password on the command line interface can be insecure.
# Source on 127.0.0.1: ... connected.
# Importing definitions from mitest.sql.
CAUTION: The following warning messages were included in the import file:
# WARNING: Using a password on the command line interface can be insecure.
# WARNING: A partial export from a server that has GTIDs enabled will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to generate the GTID statement, use the --skip-gtid option. To export all databases, use the --all and --export=both options.
DROP DATABASE IF EXISTS `test`
CREATE DATABASE `test`
USE `test`
CREATE TABLE `c1` (
`f1` varchar(255) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE `dsns` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) DEFAULT NULL,
`dsn` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
GRANT ALTER ON `test`.* TO ''@'%'
GRANT CREATE ON `test`.* TO ''@'%'
GRANT CREATE ROUTINE ON `test`.* TO ''@'%'
GRANT CREATE TEMPORARY TABLES ON `test`.* TO ''@'%'
GRANT CREATE VIEW ON `test`.* TO ''@'%'
GRANT DELETE ON `test`.* TO ''@'%'
GRANT DROP ON `test`.* TO ''@'%'
GRANT EVENT ON `test`.* TO ''@'%'
GRANT INDEX ON `test`.* TO ''@'%'
GRANT INSERT ON `test`.* TO ''@'%'
GRANT LOCK TABLES ON `test`.* TO ''@'%'
GRANT REFERENCES ON `test`.* TO ''@'%'
GRANT SELECT ON `test`.* TO ''@'%'
GRANT SHOW VIEW ON `test`.* TO ''@'%'
GRANT TRIGGER ON `test`.* TO ''@'%'
GRANT UPDATE ON `test`.* TO ''@'%'
USE `test`
#...done.
Suggested fix:
Let skip work