Question: This is the SQL line I'm using to create the table:

```
CREATE TABLE users ( 
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
    firstname VARCHAR(255), 
    surname VARCHAR(255), 
    email VARCHAR(255) UNIQUE, 
    username VARCHAR(255) UNIQUE, 
    passwordHash CHAR(60), 
    admin BIT 
)

```

Should be pretty generic, however, I'm getting the error "Specified key was too long; max key length is 767 bytes"

Which just leaves me wondering, what key is too long? The longest is supposedly 255B, no?

Answer: 
It depends on your server default encoding. For instance, in UTF-8 you use three bytes for each character.

The issue comes from 'UNIQUE' constraint on VARCHAR(255) columns.
Here Try This out:-

```
CREATE TABLE users ( 
id INT NOT NULL AUTO_INCREMENT, 
firstname VARCHAR(255), 
surname VARCHAR(255), 
email VARCHAR(255) UNIQUE, 
username VARCHAR(255) UNIQUE, 
passwordHash CHAR(60), 
admin BIT,
PRIMARY KEY (id),
CONSTRAINT user_info UNIQUE(email,username)
);

```

i think this will work