Query caches are useful as far as the database performance is concerned, as it makes a cache of the used queries and thus can fetch the data quickly.
In this tutorial we will learn to enable the mysql query cache feature.
Step 1- MySQL Folder
To enable mysql query caching, first of all, open up the “my.ini” file in the MySQL instance.
As we are using WAMP server, we will simply click on its icon on the taskbar, then go to MySQL and click on the “my.ini” file.
![Locating my.ini File Locating my.ini File](https://howtech.tv/wp-content/images/003113/1.jpg)
Step 2- Modifying the File
With the file opened up, scroll down to the bottom and just add the following lines:
query_cache_type=1
query_cache_size=20M
With that done, just save the file and close it.
![Adding Cache configurations Adding Cache configurations](https://howtech.tv/wp-content/images/003113/2.jpg)
Step 3- Restarting Wamp Services
After that, we have to restart all our Wamp services.
Wait for the Wamp icon to turn green again.
![Restarting the Server Restarting the Server](https://howtech.tv/wp-content/images/003113/3.jpg)
Step 4- Opening the Console
Now open up the MySQL console to verify the working of mysql query cache feature.
![MySQL Console MySQL Console](https://howtech.tv/wp-content/images/003113/4.jpg)
Step 5- Cache Statistics
With the console opened up, write the following query:
SHOW VARIABLES LIKE ‘%query_cache%’;
A table would appear and next to the query cache option, the value would be “YES” which means that the feature has been enabled.
![Cache Options Cache Options](https://howtech.tv/wp-content/images/003113/5.jpg)
And this is how we can enable mysql query caching feature.