-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couldn't get it to work using MySQL #38
Comments
Do you have a stacktrace? |
No, Unfortunately I didn't save it. But it has something to do with the primary key being too long, I've had this error before with trying to set a varchar as a primary key and I don't know how to solve it |
I have bumped into this issue right now (with MariaDB). Will try to figure it out. |
OK, so the issue is specific to MySQL, and the error-causing query is this: alter table `sessions` add primary key `sessions_pkey`(`sid`)
The problem is that in certain charsets, such as In "regular" MySQL installations this doesn't happen because MySQL defaults to a 3-byte "utf8" charset ( The way to circumvent this issue right now is to set create table `sessions` (
`sid` varchar(100) primary key,
`sess` text not null,
`expired` datetime not null,
index (`expired`)
) Could the default length be shortened in this library, and maybe provide an option to set it manually if necessary? @llambda would you accept a PR? The default key generation in In any case it would be helpful to provide this as an option, just in case: new KnexSessionStore({ sidLength: 50 }) |
Interesting. I would accept a PR. |
I keep getting an error
ER_TOO_LONG_KEY: Specified key was too long; max key length is 767 bytes
when trying to create the required sessions table, any ideas?The text was updated successfully, but these errors were encountered: