Mysql
架構從 mysql 4 遷移到 mysql 5.6 後的問題
最近,我將一些模式從
mysql 4
實例遷移到了mysql 5.6
bymysqldump
和 import 操作的實例中。經過一些語法調整,我可以成功導入轉儲文件。導入後,我查看了日誌文件,發現了一些問題。有誰知道那是什麼以及如何解決它?
InnoDB: Error in pars0opt.cc: table cars/cars_ftr_a has prefix_len != 0 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_BEING_DELETED' InnoDB: in InnoDB data dictionary has unknown flags 50. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_BEING_DELETED_CACHE' InnoDB: in InnoDB data dictionary has unknown flags 50. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_CONFIG' InnoDB: in InnoDB data dictionary has unknown flags 50. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_DELETED' InnoDB: in InnoDB data dictionary has unknown flags 50. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_DELETED_CACHE' InnoDB: in InnoDB data dictionary has unknown flags 50. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_000000000000040c_INDEX_1' InnoDB: in InnoDB data dictionary has unknown flags 40. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_000000000000040c_INDEX_2' InnoDB: in InnoDB data dictionary has unknown flags 40. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_000000000000040c_INDEX_3' InnoDB: in InnoDB data dictionary has unknown flags 40. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_000000000000040c_INDEX_4' InnoDB: in InnoDB data dictionary has unknown flags 40. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_000000000000040c_INDEX_5' InnoDB: in InnoDB data dictionary has unknown flags 40. 2017-08-16 17:14:15 7fd3081c4700 InnoDB: Warning: table 'cars/FTS_00000000000002cb_000000000000040c_INDEX_6' InnoDB: in InnoDB data dictionary has unknown flags 40.
編輯(添加創建表語句)
Create Table: CREATE TABLE `cars_ftr_a` ( `id` int(10) unsigned NOT NULL DEFAULT '0', `manufacturer` varchar(100) NOT NULL DEFAULT '', `model` varchar(255) NOT NULL DEFAULT '', `object_type` int(10) unsigned NOT NULL DEFAULT '0', `fts_string` text NOT NULL, `manufactor_id` int(10) unsigned NOT NULL DEFAULT '0', `model_id` int(10) unsigned NOT NULL DEFAULT '0', `version_id` int(10) unsigned NOT NULL DEFAULT '0', `version` varchar(100) NOT NULL DEFAULT '', `group_id` int(10) unsigned NOT NULL DEFAULT '0', `group_name` varchar(100) DEFAULT NULL, `a` int(10) unsigned DEFAULT NULL, `b` varchar(100) NOT NULL DEFAULT '', `price` int(10) unsigned NOT NULL DEFAULT '0', `c` int(10) unsigned NOT NULL DEFAULT '0', `d` varchar(100) NOT NULL DEFAULT '', `e` float NOT NULL DEFAULT '0', `f` int(10) unsigned NOT NULL DEFAULT '0', `g` int(10) unsigned NOT NULL DEFAULT '0', `h` int(10) unsigned NOT NULL DEFAULT '0', `i` smallint(6) unsigned NOT NULL DEFAULT '0', `j` varchar(100) NOT NULL DEFAULT '', `k` int(10) unsigned NOT NULL DEFAULT '0', `l` int(10) unsigned NOT NULL DEFAULT '0', `m` int(10) unsigned NOT NULL DEFAULT '0', `n` varchar(100) NOT NULL DEFAULT '', `o` int(10) unsigned NOT NULL DEFAULT '0', `p` text NOT NULL, `q` varchar(100) NOT NULL DEFAULT '', `r` int(10) unsigned NOT NULL DEFAULT '0', `s` varchar(100) NOT NULL DEFAULT '', PRIMARY KEY (`id`,`fts_string`(10)), FULLTEXT KEY `fts_string` (`fts_string`) ) ENGINE=InnoDB DEFAULT CHARSET=hebrew
發布表格結構後,有兩件事成為焦點
- InnoDB 表有全文索引
- 你的字元集是希伯來語
你會相信 7 年前有人問過 MySql 全文搜尋是否適用於非拉丁語言(希伯來語、阿拉伯語、日語……)?
你應該確保你的 MySQL 安裝中有希伯來字元集
mysql> select * from INFORMATION_SCHEMA.CHARACTER_SETS where CHARACTER_SET_NAME='Hebrew'; +--------------------+----------------------+-------------------+--------+ | CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME | DESCRIPTION | MAXLEN | +--------------------+----------------------+-------------------+--------+ | hebrew | hebrew_general_ci | ISO 8859-8 Hebrew | 1 | +--------------------+----------------------+-------------------+--------+ 1 row in set (0.00 sec)
以及必要的排序規則
mysql> select * from INFORMATION_SCHEMA.COLLATIONS where CHARACTER_SET_NAME='Hebrew'; +-------------------+--------------------+----+------------+-------------+---------+ | COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN | +-------------------+--------------------+----+------------+-------------+---------+ | hebrew_general_ci | hebrew | 16 | Yes | Yes | 1 | | hebrew_bin | hebrew | 71 | | Yes | 1 | +-------------------+--------------------+----+------------+-------------+---------+ 2 rows in set (0.00 sec)
您可以嘗試創建一個具有相同結構的新表並載入它。
方法#1
CREATE TABLE cars_ftr_a LIKE cars_ftr_a_new; INSERT INTO cars_ftr_a_new SELECT * FROM cars_ftr_a; RENAME TABLE cars_ftr_a TO cars_ftr_a_old,cars_ftr_a_new TO cars_ftr_a;
方法#2
ALTER TABLE cars_ftr_a ENGINE=InnoDB;
然後,查看錯誤日誌,看看是否再次出現相同的警告。如果他們不這樣做,你就可以走了。您還應該考慮調整 InnoDB 全文選項。
更新 2017-08-22 23:17 EDT
方法#3
您可以嘗試的另一件事是刪除全文索引並再次創建它
ALTER TABLE cars_ftr_a DROP INDEX `fts_string`; ALTER TABLE cars_ftr_a ADD FULLTEXT `fts_string` (`fts_string`);
然後,檢查日誌以查看是否再次出現相同的錯誤。
更新 2017-08-23 11:04 EDT
方法#4
CREATE TABLE cars_ftr_a LIKE cars_ftr_a_tmp; ALTER TABLE cars_ftr_a_tmp DROP INDEX `fts_string`; INSERT INTO cars_ftr_a_tmp SELECT * FROM cars_ftr_a; RENAME TABLE cars_ftr_a TO cars_ftr_a_xxx,cars_ftr_a_tmp TO cars_ftr_a; ALTER TABLE cars_ftr_a ADD FULLTEXT `fts_string` (`fts_string`);
載入沒有全文索引的新表。然後最後創建全文索引。