1

Topic: MySQL ERROR 1071

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
======== Required information ====
- iRedMail version: 0.9.7
- Linux/BSD distribution name and version: Ubuntu 16.04.2 LTS
- Store mail accounts in which backend: MySQL
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? NO
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

When attempting to do the actions specified in "MySQL/MariaDB backend special" I get the following error message:

MariaDB [vmail]> CREATE TABLE IF NOT EXISTS alias_moderators (
    ->     id BIGINT(20) UNSIGNED AUTO_INCREMENT,
    ->     address VARCHAR(255) NOT NULL DEFAULT '',
    ->     moderator VARCHAR(255) NOT NULL DEFAULT '',
    ->     domain VARCHAR(255) NOT NULL DEFAULT '',
    ->     dest_domain VARCHAR(255) NOT NULL DEFAULT '',
    ->     PRIMARY KEY (id),
    ->     UNIQUE INDEX (address, moderator),
    ->     INDEX (domain),
    ->     INDEX (dest_domain)
    -> ) ENGINE=InnoDB;
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

What can I do to resolve this issue.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: MySQL ERROR 1071

rrosson wrote:

    ->     address VARCHAR(255) NOT NULL DEFAULT '',
    ->     moderator VARCHAR(255) NOT NULL DEFAULT '',
            ...
    ->     UNIQUE INDEX (address, moderator),
...
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

Try to shorten the length of "address" and "moderator" column to, e.g. 200 like this:

address VARCHAR(200) NOT NULL DEFAULT '',
moderator VARCHAR(200) NOT NULL DEFAULT '',

If it's still too long, shorten to 150, or even 100.
Both columns are used to store a single email address, so 100 should be enough.

3

Re: MySQL ERROR 1071

Changing the VARCHAR to 150 did the trick.

TIA