Knowledge Base

Configuring MySQL 8

Last Modified:
30 Sep 2022
User Level:
Administrator

Terminalfour 8.3.14 introduced support for MySQL 8.0. Below is some guidance on configuring it if you are self-hosted.

Database table engine, collations, and charset

Table Engine InnoDB is the preferred and supported database table engine for MySQL 5.7 and MySQL 8.0. All tables should be using InnoDB.
CHARSET  utf8mb4*
COLLATE utf8mb4_0900_ai_ci

*utf8mb3 should not be used

Ensure that the character sets are set correctly on the database

In my.cnf (Linux) or my.ini (Windows), edit the file, and add the following:

[mysql]
default-character-set=utf8mb4
[mysqld]
character-set-server=utf8mb4

MySQL JDBC

The newer version of the JDBC driver must be used and placed into Tomcat's lib directory. 

Tomcat server.xml

Some changes are required to the Tomcat server.xml file

Resource driverClassName

<!--This class path works but it is deprecated and should be changed-->
driverClassName="com.mysql.jdbc.Driver"
 

<!--Change it to the following, note the "cj"-->
driverClassName="com.mysql.cj.jdbc.Driver"

Resource url

  • Note that the &  symbol separator may be &  instead, which is its HTML entity equivalent
  • For Connector/J 8.0.23 and later, serverTimezone is an alias for connectionTimeZone. serverTimezone will work for older versions of the connector, but its not recommended to use older versions of the connector.
<!--Original database URL for MySQL 5.7 and MySQL 5.1.x JDBC-->
url="jdbc:mysql://127.0.0.1:3306/terminalfour?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8"
 
<!--Add the following "connectionTimeZone=UTC" parameter to the database URL for MySQL 8.0 and when using the newer MySQL 8 JDBC-->
url="jdbc:mysql://127.0.0.1:3306/terminalfour?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&connectionTimeZone=UTC"