Error executing nova-manage db sync, prompting ' Specified key was too long; Max key length is bytes '

Source: Internet
Author: User

Error executing nova-manage DB sync:

2012-03-24 14:07:01 CRITICAL Nova [-] (Operationalerror) (1071, ' Specified key was too long; Max key length is $ bytes ' ) ' \ncreate TABLE user_project_association (\n\tcreated_at datetime, \n\tupdated_at datetime, \n\tdeleted_at datetime, \ n\tdeleted BOOL, \n\tuser_id varchar (255) NOT NULL, \n\tproject_id varchar (255) is not NULL, \n\tprimary KEY (user_id, Projec t_id), \n\tcheck (deleted in (0, 1)), \n\tforeign key (user_id) REFERENCES users (ID), \n\tforeign key (project_id) Referenc ES projects (id) \ n \ n ' ()

The reason is that one primary key for OpenStack Nova primary key (USER_ID, project_id) is too long.

Each is 256 bytes, and the two are 512 bytes, at this point:

1, because MySQL does use MYISAM table type, each key cannot exceed 1k bytes

2, because MySQL set utf-8, each character occupies 3 bytes, so that 512*3 more than 1K bytes

Workaround:

1, MySQL server do not use Utf-8, using Latin1

Or:

2, MySQL server uses INNODB as the table structure, so no key is 1k byte limit

Vi/etc/my.cnf

[Mysqld]

Default_table_type = InnoDB

Character-set-server=utf8
init_connect= ' SET NAMES utf8′

This problem, has been met, submitted a bug, but has no one to answer, I also replied: https://bugs.launchpad.net/nova/+bug/829209

Error executing nova-manage db sync, prompting ' Specified key was too long; Max key length is bytes '

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.