How to drop RDS MySQL table with error 1709?

0

I have a table in RDS/MySQL Community 8.0.16 database instance, that was accidentally indexed with utf8mb32. Now there seems to be no way of getting rid of the table using the RDS sandbox only. All operations result in Error Code: 1709. Index column size too large. The maximum column size is 767 bytes.

Any ideas?

Cheers, Joni

J_N__
質問済み 1年前414ビュー
1回答
-1

The error you're encountering, "Error Code: 1709. Index column size too large. The maximum column size is 767 bytes", is due to a limitation in MySQL for the maximum index length in InnoDB tables when using the COMPACT row format. The utf8mb4 character set uses a maximum of 4 bytes per character, so if you have a VARCHAR(255) column (which could be up to 1020 bytes), it exceeds the 767-byte limit.

Here's how you can drop the table:

  1. Change the Global innodb_large_prefix setting:

First, you need to change the innodb_large_prefix setting to ON. This can be done by modifying the parameter group associated with your RDS instance.

  1. Change the innodb_file_format:

Next, you have to set innodb_file_format to Barracuda. This can also be done in the parameter group.

  1. Change the innodb_file_per_table:

Set innodb_file_per_table to 1. This can also be done in the parameter group.

  1. Restart the RDS instance:

After applying these changes, you need to reboot your RDS instance for the changes to take effect.

  1. Drop the table:

Now, you should be able to drop the table using the regular DROP TABLE command:

DROP TABLE your_table_name;

Remember to replace your_table_name with the actual name of your table.

After dropping the table, you can revert the changes to the parameter group if you wish.

This error often occurs when trying to use utf8mb4 character set without setting up the appropriate parameters. If you plan to use utf8mb4 in the future, you should consider keeping these settings to avoid similar problems.

profile picture
回答済み 1年前
  • I can only see the innodb_file_per_table parameter in the available settings, so this unfortunately won't do. There is no innodb_large_prefix or innodb_file_format parameters available for editing, apparently because it is RDS.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ