Unable to create a new Gateway database: Specified key was too long; max key length is 767 bytes
book
Article ID: 42967
calendar_today
Updated On:
Products
STARTER PACK-7CA Rapid App SecurityCA API Gateway
Issue/Introduction
Solution
Background
The Layer 7 Gateway database typically runs within the MySQL relational database management system. The MySQL RDBMS (the "MySQL server") must be configured properly to accept the SQL queries used my the Gateway configuration script (setup.sh). The Gateway configuration script creates a new Gateway database using a pre-built series of SQL queries. These SQL queries must be encoded using UTF-8. If the MySQL server is not configured to use UTF-8 by default, the Gateway database creation (and as such, the configuration) will fail.
Presentation
The error presents itself when creating and configuring a new Gateway database. At the conclusion of the configuration, the configuration script will return an error:?Error creating database when saving configuration 'Unable to create database'. There will also be an error log in the Gateway configuration log (config.log) stating:?Could not create database. An exception occurred: Specified key was too long; max key length is 767 bytes
Resolution
This issue is resolved by making a configuration change in the MySQL server configuration file (my.cnf). ?Add the following directive under the "mysqld" block:?character-set-server=utf. For example, you should see the following in the configuration file: [mysqld] character-set-server=utf8
After making the change, you will need to restart the MySQL server for the changes to take effect. Once MySQL has restarted, attempt to configure and create the Gateway database again.