標籤:mariadb
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 /tmpmv /data/mysql/mysql/innodb_table_stats.ibd /tmpmv /data/mysql/mysql/gtid_slave_pos.ibd /tmpmysql -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找不到的解決方案