Ask Your Question

Mitaka on 16.04 Xenial and mysql's new default utf8mb4 charset

asked 2016-04-27 09:05:24 -0500

romyv gravatar image

Fresh install of Mitaka on default install of Xenial fails during populating the database steps.

The default character set of mysqld in Debian has been changed to utf8mb4 (from utf8), and "glance-manage db_sync" fails with:

2016-04-26 16:09:13.091 21061 ERROR oslo_db.sqlalchemy.exc_filters [-] DBAPIError exception wrapped from (pymysql.err.InternalError) (1071, u'Specified key was too long; max key length is 767 bytes') [SQL: u'\nCREATE TABLE migrate_version (\n\trepository_id VARCHAR(250) NOT NULL, \n\trepository_path TEXT, \n\tversion INTEGER, \n\tPRIMARY KEY (repository_id)\n)\n\n']

The length of the key for 'repository_id' with max 250 chars and 4 bytes per char makes it longer than the 767 allowed by innodb. (

Note:this was a multi-region setup, so glance was first component that needed a database sync. Most likely keystone install would also fail if one did install the identity service (during "keystone-manage db_sync") - (

The settings in /etc/mysql/conf.d/openstack.cnf (eg, "character-set-server = utf8", init-connect and collation-server) don't seem to suffice.

Need to also set the following:

/etc/mysql/mariadb.conf.d/50-server.cnf:character-set-server = utf8

/etc/mysql/mariadb.conf.d/50-server.cnf:collation-server = utf8_general_ci

/etc/mysql/mariadb.conf.d/50-client.cnf:default-character-set = utf8

/etc/mysql/mariadb.conf.d/50-mysql-clients.cnf:default-character-set = utf8

Had the above logged to ( in case you need to follow-up

edit retag flag offensive close merge delete

6 answers

Sort by ยป oldest newest most voted

answered 2016-11-22 06:07:10 -0500

Bharathi gravatar image

Dropping Keystone database and Re-Creating new Keystone Database fixed the issue

edit flag offensive delete link more

answered 2017-02-23 06:27:56 -0500

hkml2000 gravatar image

solved by this sql query


edit flag offensive delete link more

answered 2016-04-29 10:07:30 -0500

romyv gravatar image

confirmed - the same "key was too long" error comes up on 'keystone-manage db_sync' as well.

edit flag offensive delete link more

answered 2016-08-12 11:17:20 -0500

openstacking gravatar image

I confirm this bug too. I get the "key was too long" error whenever I try to populate the identity service database using the command 'keystone-managae db_sync'. I'm installing Mitaka on Ubuntu 16.04 LTS

edit flag offensive delete link more

answered 2016-05-17 17:49:48 -0500

OussamaMJ gravatar image

There is any update about this bug. Till now, OpenStack documentation supports just ubuntu 14.04.

edit flag offensive delete link more

answered 2018-11-28 00:16:01 -0500

It was because the max key length is 767 byte, and repository_id was varchar(250), if we use utf8mbt4, then the actural length might be 1000 which is exceed the 767 limit. Change to utf8, 250*3=750 was not exceed the 767 limit, so it works.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools



Asked: 2016-04-27 09:02:22 -0500

Seen: 2,309 times

Last updated: Aug 12 '16