Would you like to learn how to enable the MySQL query cache feature? In this tutorial, we are going to show you how to configure the query cache to improve the performance of your MySQL server on a computer running Ubuntu Linux.

• Ubuntu 18.04
• MySQL 5.7.31

MySQL version 8 removed the support to query cache.

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Tutorial MySQL – Enable the Query cache

Access the MySQL command-line.

Copy to Clipboard

Verify the MySQL query cache status.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

In our example, the MySQL query cache feature is disabled.

Edit the MySQL configuration file.

Copy to Clipboard

Insert the following lines under the area named MYSQLD.

Copy to Clipboard

In our example, we enabled the MySQL query cache feature.

In our example, we limited the use of the cache to 100 Megabytes.

In our example, we set the maximum size of a single result set to 1 Megabyte.

Restart the MySQL service.

Copy to Clipboard

Verify the MySQL query cache status.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Verify details of the MySQL cache configuration.

Copy to Clipboard

Congratulations! You successfully enabled the MySQL query cache.