반응형
script/generate acts_as_taggable_on_migration
rake db:migrate
원인
Mysql::Error: Specified key was too long; max key length is 1000 bytes: CREATE INDEX `index_taggings_on_taggable_id_and_taggable_type_and_context` ON `taggings` (`taggable_id`, `taggable_type`, `context`)
어떻게해야합니까?
내 데이터베이스 인코딩은 다음과 같습니다.
mysql> SHOW VARIABLES LIKE 'character\_set\_%';
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
+--------------------------+--------+
7 rows in set (0.00 sec)
해결 방법
이것은 전적으로 MySQL 문제입니다.
MySQL에는 MyISAM, InnoDB, 메모리 등 다른 엔진이 있습니다.
상한값에 도달했을 때 일부 인덱싱을 수용하기 위해 열 데이터 유형의 일부와 관련하여 인덱스를 정의 할 수 있습니다.
CREATE INDEX example_idx ON YOUR_TABLE(your_column(50))
your_column
이 VARCHAR (100)
이라고 가정하면 위 예제의 색인은 처음 50 자에만 있습니다. 50 번째 문자를 초과하는 데이터를 검색하면 인덱스를 사용할 수 없습니다.
참조 페이지 https://stackoverflow.com/questions/3489041
반응형
'MySql' 카테고리의 다른 글
MySQL XAMPP에 MariaDB 또는 MySQL이 있습니까? (0) | 2020.11.13 |
---|---|
MySQL 생성 시간 및 업데이트 타임 스탬프 (0) | 2020.11.13 |
MySQL에서 호출되는 HTML 테이블의 행을 정렬하는 방법 (0) | 2020.11.13 |
MySQL 5.7에서 6 자 암호를 만드는 방법 (0) | 2020.11.13 |
MySQL How to drop all tables in database without dropping the database itself? (0) | 2020.11.13 |
댓글