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 '