[MySQL] Index追加でエラーがでる時の対応

1. Indexを追加しようとして、コマンドを叩くとエラーがでる。 mysql> alter table csv.tb1 add index index_ymd(ymd); ERROR 1170 (42000): BLOB/TEXT column 'ymd' used in key specification without a key length →解決 https://qiita.com/mizuki_takahashi/items/52bc426307817123305e インデックス作成時にキー長を明示してあげる必要がある。 Mysql> alter table csv.tb1 add index index_ymd(ymd(8)); Query OK, 0 rows affected (0.20 sec) Records: 0 Duplicates: 0 Warnings: 0 これでOK