mariadb10.x安装方式为yum时,当启用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
本文出自 “激情燃烧的岁月” 博客,请务必保留此出处http://liuzhengwei521.blog.51cto.com/4855442/1930338
mariadb10.x启用gtid复制时提示mysql.gtid_slave_pos找不到的解决方案
原文:http://liuzhengwei521.blog.51cto.com/4855442/1930338