ibdconnect is a tool to connect an ibd file to a foreign ibdata file. it’s important to understand how it works as secondary keys may cause interesting behavior.
Here is a table with a unique secondary key:
CREATE TABLE `t1` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`value` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uni_value` (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
When I update InnoDB dictionary with ibdconnect it all goes well:
# ./ibdconnect -f t1.idb -o /var/lib/mysql/ibdata1 -d test -t t1
Updating test/t1 (table_id 13) with id 0xA3060000
SYS_TABLES is updated successfully
SYS_INDEXES is updated successfully
ibdconnect modifies content of ibdata1, so checksums are wrong now.