mysql的版本是InnoDB 5.6.10-log,pt-online-schema-Change3.1.0.表信息是
`email` varchar(225) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`uid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`hotel_brand_id` int(11) DEFAULT NULL,
UNIQUE KEY `index_membership_customers_on_uid_and_hotel_brand_id` (`uid`,`hotel_brand_id`),我的目的是添加一个唯一的索引,
pt-online-schema-change --recursion-method=none --nocheck-unique-key-change h=$DATABASE_HOST,D=$DATABASE,t=$TABLE,u=$DATABASE_USER,p=$DATABASE_PASSWORD --alter "ADD UNIQUE INDEX index_membership_customers_on_email_and_hotel_brand_id (email, hotel_brand_id)" --$RUN --alter-foreign-keys-method=auto然后我遇到了唯一的索引长度问题(https://stackoverflow.com/questions/1814532/mysql-error-1071-specified-key-was-too-long-max-key-length-is-767-bytes),
Creating new table...
Error creating new table: DBD::mysql::db do failed: Specified key was too long; max key length is 767 bytes [for Statement "CREATE TABLE `umami_prod`.`_membership_customers_new` (似乎是因为这个原因
`uid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
UNIQUE KEY `index_membership_customers_on_uid_and_hotel_brand_id` (`uid`,`hotel_brand_id`)因此,我想调整列的大小或更改它的字符集,但是不管我要做什么,它都失败了,因为pt-online-schema-change首先尝试创建一个新表,然后由于索引长度问题而失败。我什么都改变不了
所以我的问题是
UNIQUE KEY `index_membership_customers_on_uid_and_hotel_brand_id` (`uid`,`hotel_brand_id`)pt-online-schema-change的一些表设置pt-online-schema-change无法工作,所以我唯一的选择是alter,锁定整个表?谢谢你的回复,任何提示都可能有帮助,谢谢
发布于 2022-06-26 04:05:49
你能和191而不是225生活在一起吗?如果没有,您的5个选项(包括该选项)如下:
http://mysql.rjweb.org/doc.php/limits#767_限制_在……里面_诺姆b_索引
https://dba.stackexchange.com/questions/313778
复制相似问题