下面一起来了解下当mariadb10.x启用gtid复制时提示找不到mysql.gtid_slave_pos怎么办,相信大家看完肯定会受益匪浅,文字在精不在多,希望当mariadb10.x启用gtid复制时提示找不到mysql.gtid_slave_pos怎么办这篇短内容是你想要的。
解决方案:/usr/share/mysql/mysql_system_tables.sql是创建系统表的脚本
找到innodb_table_stats,innodb_index_stats,gtid_slave_pos表的创建方式
innodb_table_stats表的创建语句:
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `innodb_table_stats`;
CREATE TABLE `innodb_table_stats` (
`database_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`n_rows` bigint(20) unsigned NOT NULL,
`clustered_index_size` bigint(20) unsigned NOT NULL,
`sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`database_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
innodb_index_stats表的创建语句:
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `innodb_index_stats`;
CREATE TABLE `innodb_index_stats` (
`database_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`index_name` varchar(64) COLLATE utf8_bin NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
`stat_value` bigint(20) unsigned NOT NULL,
`sample_size` bigint(20) unsigned DEFAULT NULL,
`stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
gtid_slave_pos表的创建语句:
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `gtid_slave_pos`;
CREATE TABLE `gtid_slave_pos` (
`domain_id` int(10) unsigned NOT NULL,
`sub_id` bigint(20) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
`seq_no` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`domain_id`,`sub_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Replication slave GTID position';
执行以下命令,即可解决表找不到的问题:
mysql -uroot -p123456 -e "drop mysql.table innodb_table_stats;"
mysql -uroot -p123456 -e "drop mysql.table innodb_index_stats;"
mysql -uroot -p123456 -e "drop mysql.table gtid_slave_pos;"
mv /data/mysql/mysql/innodb_index_stats.ibd /tmp
mv /data/mysql/mysql/innodb_table_stats.ibd /tmp
mv /data/mysql/mysql/gtid_slave_pos.ibd /tmp
mysql -uroot -p123456 -e "use mysql;source /root/innodb_index_stats.sql;"
mysql -uroot -p123456 -e "use mysql;source /root/innodb_table_stats.sql;"
mysql -uroot -p123456 -e "use mysql;source /root/gtid_slave_pos.sql;"
/etc/init.d/mysql restart
看完当mariadb10.x启用gtid复制时提示找不到mysql.gtid_slave_pos怎么办这篇文章后,很多读者朋友肯定会想要了解更多的相关内容,如需获取更多的行业信息,可以关注我们的数据库栏目。