You may encounter Error 1071 in MariaDB when trying to create an index on a column or a set of columns larger than 767 bytes, which is the default maximum key length in InnoDB. Follow these steps to resolve the error:
1. `ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;`
Replace `database_name` with your actual database name.
1. For each table, execute the following statements:
- `ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`
- `ALTER TABLE table_name ROW_FORMAT=DYNAMIC;`
Replace `table_name` with your actual table name.
1. In your MariaDB/MySQL configuration file (usually `my.cnf` or `my.ini`), add the following lines under the [mysqld] section:
```
innodb_large_prefix=on
innodb_file_format=barracuda
innodb_file_per_table=true
```
1. Restart the MariaDB/MySQL service.
This setting allows you to store up to 3072 bytes into an InnoDB index, which should be enough for any key.
Remember to make a backup of your database before making these changes.
If you are still encountering issues, you may also consider reducing the size of your column or setting a prefix length on your index.