Error
[root@localhost log]# more metadata-service.log | grep -i error
2021-08-13T05:50:35.245Z [jfmd ] [WARN ] [1b5644480c9d339f] [migrator.go:201 ] [main ] - This error occurred when upgrading the database : 'Error 1071: Specified key was too long; max key length is 3072 bytes'. [database]
2021-08-13T05:50:35.247Z [jfmd ] [ERROR] [1b5644480c9d339f] [migrator.go:194 ] [main ] - Migration v038_file_targets.sql failed ! Rollback to latest successful migration. Err: Error 1071: Specified key was too long; max key length is 3072 bytes. Panic : <nil> [database]
2021-08-13T05:50:35.248Z [jfmd ] [PANIC] [1b5644480c9d339f] [application.go:89 ] [main ] - Could not execute database migrations Error 1071: Specified key was too long; max key length is 3072 bytes
Solution
--------------------- THIS WORKED----------------------------
$ mysql -h localhost -u root -p
CREATE DATABASE artdb CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'artifactory1'@'%' IDENTIFIED BY 'password';
GRANT ALL on artdb.* TO 'artifactory1'@'%';
FLUSH PRIVILEGES;
--------------------- THIS WORKED----------------------------
Some Troubleshooting Commands to Check this Error
SET GLOBAL default_storage_engine = 'InnoDB'
SET GLOBAL default_storage_engine = 'InnoDB';
USE <database>;
SHOW TABLE STATUS\G
ALTER TABLE md_database_migrations CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE md_database_migrations CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER DATABASE artifactory CHARACTER SET utf8 COLLATE utf8_bin;
use artifactory;
ALTER TABLE md_database_migrations CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
Reference
- https://confluence.atlassian.com/fisheye/migrating-to-mysql-960155589.html
- https://www.jfrog.com/jira/si/jira.issueviews:issue-html/RTFACT-24896/RTFACT-24896.html
Latest posts by rajeshkumar (see all)
- How to get Blackduck Trial version? - December 3, 2023
- PHP ionCube Error: cannot be decoded by this version of the ionCube Loader - December 2, 2023
- Cloudbees CD/RO Error: ectool - November 24, 2023