Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Liferay 6.2 CE GA5 Database Migration from SQL Server to MySQL
Hi,
We are migrating a Liferay instance (6.2 CE GA5) which is currently running off MS SQL Server 2012 and into MySQL 5.6. MySQL Workbench has a migration tool which we used but we are getting errors around Index sizes, see below:
I have experimented by changing the character limits, which does migrate the DB, but then Liferay does not start.
Any ideas on what I should try next?
Thanks
Mashuk
We are migrating a Liferay instance (6.2 CE GA5) which is currently running off MS SQL Server 2012 and into MySQL 5.6. MySQL Workbench has a migration tool which we used but we are getting errors around Index sizes, see below:
ERROR: Error executing 'CREATE TABLE IF NOT EXISTS `SchemaName`.`JournalContentSearch` (
`contentSearchId` BIGINT NOT NULL,
`groupId` BIGINT NULL,
`companyId` BIGINT NULL,
`privateLayout` SMALLINT NULL,
`layoutId` BIGINT NULL,
`portletId` VARCHAR(200) CHARACTER SET 'utf8mb4' NULL,
`articleId` VARCHAR(75) CHARACTER SET 'utf8mb4' NULL,
INDEX `IX_9207CB31` (`articleId` ASC),
INDEX `IX_6838E427` (`groupId` ASC, `articleId` ASC),
INDEX `IX_20962903` (`groupId` ASC, `privateLayout` ASC),
INDEX `IX_7CC7D73E` (`groupId` ASC, `privateLayout` ASC, `articleId` ASC),
INDEX `IX_B3B318DC` (`groupId` ASC, `privateLayout` ASC, `layoutId` ASC),
INDEX `IX_7ACC74C9` (`groupId` ASC, `privateLayout` ASC, `layoutId` ASC, `portletId` ASC),
UNIQUE INDEX `IX_C3AA93B8` (`groupId` ASC, `privateLayout` ASC, `layoutId` ASC, `portletId` ASC, `articleId` ASC),
INDEX `IX_8DAF8A35` (`portletId` ASC))'
Index column size too large. The maximum column size is 767 bytes..
SQL Error: 1709Since the characterset is utf8mb4, each character is using 4 bytes per character and with the portletid set to VARCHAR(200), that is exceeding the limit. I have experimented by changing the character limits, which does migrate the DB, but then Liferay does not start.
Any ideas on what I should try next?
Thanks
Mashuk
Hi Mashuk,
As far as I remember in Mysql 5.6, you have to modify each create table statement to designate for UTF8MB4. This constraint forces you to change all the create table statements.
Could you use Mysql 5.7 where this restriction is not needed?
If the problem persist, can you try to remove the problematic indexes before doing the migration and try to recreate them (with a limitation for varchar fields in the final database)?
I hope it helps.
As far as I remember in Mysql 5.6, you have to modify each create table statement to designate for UTF8MB4. This constraint forces you to change all the create table statements.
Could you use Mysql 5.7 where this restriction is not needed?
If the problem persist, can you try to remove the problematic indexes before doing the migration and try to recreate them (with a limitation for varchar fields in the final database)?
I hope it helps.
Hi Alberto,
I managed to resolve the issue by setting a character limit on the troublesome index, which in my case was portletId.
ERROR: Error executing 'CREATE TABLE IF NOT EXISTS `SchemaName`.`JournalContentSearch` (
`contentSearchId` BIGINT NOT NULL,
`groupId` BIGINT NULL,
`companyId` BIGINT NULL,
`privateLayout` SMALLINT NULL,
`layoutId` BIGINT NULL,
`portletId` VARCHAR(200) CHARACTER SET 'utf8mb4' NULL,
`articleId` VARCHAR(75) CHARACTER SET 'utf8mb4' NULL,
INDEX `IX_9207CB31` (`articleId` ASC),
INDEX `IX_6838E427` (`groupId` ASC, `articleId` ASC),
INDEX `IX_20962903` (`groupId` ASC, `privateLayout` ASC),
INDEX `IX_7CC7D73E` (`groupId` ASC, `privateLayout` ASC, `articleId` ASC),
INDEX `IX_B3B318DC` (`groupId` ASC, `privateLayout` ASC, `layoutId` ASC),
INDEX `IX_7ACC74C9` (`groupId` ASC, `privateLayout` ASC, `layoutId` ASC, `portletId`(190) ASC),
UNIQUE INDEX `IX_C3AA93B8` (`groupId` ASC, `privateLayout` ASC, `layoutId` ASC, `portletId`(190) ASC, `articleId` ASC),
INDEX `IX_8DAF8A35` (`portletId`(190) ASC))'
Index column size too large. The maximum column size is 767 bytes..
SQL Error: 1709
Thanks
Mashuk