In Mysql database we use MySQL connector to connect from java application. Till 5.7 of MySQL query_cache_size is supported but MySQL 8 this support is removed. In our application if we use MySQL connector 5.1.36 with MySQL database version 8 we will get below error

[main] ERROR ConnectionPool - Unable to create initial connections of pool.
java.sql.SQLException: Unknown system variable 'query_cache_size'
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2497)
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2455)
 at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)

This error can be fixed by increasing the MySQL connector version in pom.xml. This is solved by including below dependency.

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.45</version>
</dependency>