MySQL/MariaDB - ER_TOO_LONG_KEY: Specified key was too long; max key length is 767 bytes
See original GitHub issueHi,
When I try to configure pigallery to use the MySQL instance on my raspberry I get: Error: Error while saving database settings: QueryFailedError: ER_TOO_LONG_KEY: Specified key was too long; max key length is 767 bytes
When I check the output of the process I get:
9/9/2019, 3:17:28 PM[[32mINFO[39m] Updating database scheme
9/9/2019, 3:17:28 PM[[33mWARN[39m] Handled error:
ErrorDTO {
code: 13,
message: 'Error while saving database settings: QueryFailedError: ER_TOO_LONG_KEY: Specified key was too long; max key length is 767 bytes',
details:
{ QueryFailedError: ER_TOO_LONG_KEY: Specified key was too long; max key length is 767 bytes
at QueryFailedError.Error (native)
at new QueryFailedError (/var/www/pigallery/node_modules/typeorm/error/QueryFailedError.js:11:28)
at Query.<anonymous> (/var/www/pigallery/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js:169:45)
at Query.<anonymous> (/var/www/pigallery/node_modules/mysql/lib/Connection.js:525:10)
at Query._callback (/var/www/pigallery/node_modules/mysql/lib/Connection.js:491:16)
at Query.Sequence.end (/var/www/pigallery/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
at Query.ErrorPacket (/var/www/pigallery/node_modules/mysql/lib/protocol/sequences/Query.js:90:8)
at Protocol._parsePacket (/var/www/pigallery/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/var/www/pigallery/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/var/www/pigallery/node_modules/mysql/lib/protocol/Parser.js:43:10)
message: 'ER_TOO_LONG_KEY: Specified key was too long; max key length is 767 bytes',
code: 'ER_TOO_LONG_KEY',
errno: 1071,
sqlMessage: 'Specified key was too long; max key length is 767 bytes',
sqlState: '42000',
index: 0,
sql: 'CREATE TABLE `user_entity` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `role` smallint NOT NULL, `permissions` text NULL, UNIQUE INDEX `IDX_3fe76ecf0f0ef036ff981e9f67` (`name`), PRIMARY KEY (`id`)) ENGINE=InnoDB',
name: 'QueryFailedError',
query: 'CREATE TABLE `user_entity` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `role` smallint NOT NULL, `permissions` text NULL, UNIQUE INDEX `IDX_3fe76ecf0f0ef036ff981e9f67` (`name`), PRIMARY KEY (`id`)) ENGINE=InnoDB',
parameters: [] } }
I’m using:
raspberry: Pi 3 Model B
OS: Linux 4.14.78-4-osmc
mysql Ver 15.1 Distrib 10.1.38-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2
npm -version: 6.11.3
Any additional information you might need to pinpoint the issue just let me know.
Is there a way to create the database schema for the pigallery?
Regards, Marco
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
MySQL Error #1071 - max key length is 767 bytes
767 bytes in MySQL version 5.6 (and prior versions), is the stated prefix limitation for InnoDB tables. It's 1,000 bytes long for MyISAM...
Read more >MariaDB 10.1.38 - Specified key was too long; max key length ...
MariaDB 10.1.38 - Specified key was too long; max key length is 767 bytes ; ALTER TABLE posts ADD UNIQUE ; CREATE ·...
Read more >[SOLVED] MySQL / MariaDB Specified key was too long
MySQL, MariaDB, Specified, key, was, too, long; max, key, length, is, 767, bytes. MySQL / MariaDB Specified key was too long; max key...
Read more >MySql /Mariadb error: max key length is 767 byte #4894 - GitHub
I inserted all needed but I received the error "Database setting is not correct: Error 1709: Index column size too large. The maximum...
Read more >Migrator: MySQL -> MariaDB: max key length is 767 bytes
The reason for this issue is the limitation on the key length in the current SQL version on the target server. In MySQL...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Patrick,
I was able to overcome this issue (creating the schema) by dropping the database and recreating it with utf8.
Steps taken: 1 - Signin to MySQL
2 - Drop database
3 - Recreate database from scratch with utf8
After this, I login to pigallery online and changed the configuration to use this database. Pigallery created the tables (and I’m guessing, everything it needs).
I had to do several restarts to the application and edit the config.json file with the correct MySQL configuration because it kept defaulting back to SQLite and memory database. But eventually it got the MySQL as primary database and is using it now.
It seams that the issue was trying to reuse a database that was already used by a previous version of pigallery.
Thanks for the tip of recreating the database.
As for the SQLite issue I’ll try to open a new issue with a proper description.
Regards, Marco
Hi,
I’m happy it get solved. There is a mechanism to upgrade to DB scheme if it changes, but that might have some errors.
Best, Patrik