diff --git a/playbooks/bbs.archlinux.org.yml b/playbooks/bbs.archlinux.org.yml
index c345169e0a4fc4c50ffbe9698a9dee8ad5f6dadd..a3a24a95cbcc59ee24dea87fa1bbe859dccd4474 100644
--- a/playbooks/bbs.archlinux.org.yml
+++ b/playbooks/bbs.archlinux.org.yml
@@ -10,7 +10,7 @@
     - { role: root_ssh }
     - { role: certbot }
     - { role: nginx }
-    - { role: mariadb }
+    - { role: mariadb, mariadb_query_cache_type: '0' }
     - { role: sudo }
     - { role: php_fpm, php_extensions: ['apcu', 'iconv', 'intl', 'mysqli'], zend_extensions: ['opcache'] }
     - { role: fluxbb }
diff --git a/roles/mariadb/defaults/main.yml b/roles/mariadb/defaults/main.yml
index 2568778d91d09881e3523fc665ecb4f72e931ed6..d217078023e5da8c412df85351fd607b3994d70b 100644
--- a/roles/mariadb/defaults/main.yml
+++ b/roles/mariadb/defaults/main.yml
@@ -9,7 +9,7 @@ mariadb_net_buffer_length: '8K'
 mariadb_read_buffer_size: '256K'
 mariadb_read_rnd_buffer_size: '512K'
 mariadb_myisam_sort_buffer_size: '8M'
-mariadb_query_cache_type: '0'
+mariadb_query_cache_type: '1'
 mariadb_query_cache_limit: '16M'
 mariadb_query_cache_size: '32M'
 mariadb_max_connections: '400'
diff --git a/roles/mariadb/templates/server.cnf.j2 b/roles/mariadb/templates/server.cnf.j2
index e2c71188c6d00be14469a7a78f66c977dde5c3ef..1d5bf186e5dda25ad36970ba3b92f833b39c47b7 100644
--- a/roles/mariadb/templates/server.cnf.j2
+++ b/roles/mariadb/templates/server.cnf.j2
@@ -23,13 +23,19 @@ net_buffer_length = {{ mariadb_net_buffer_length }}
 read_buffer_size = {{ mariadb_read_buffer_size }}
 read_rnd_buffer_size = {{ mariadb_read_rnd_buffer_size }}
 myisam_sort_buffer_size = {{ mariadb_myisam_sort_buffer_size }}
-query_cache_type = {{ mariadb_query_cache_type }}
-query_cache_limit = {{ mariadb_query_cache_limit }}
-query_cache_size = {{ mariadb_query_cache_size }}
 max_connections = {{ mariadb_max_connections }}
 thread_cache_size = {{ mariadb_thread_cache_size }}
 userstat = 1
 
+# Query cache settings
+query_cache_type = {{ mariadb_query_cache_type }}
+query_cache_limit = {{ mariadb_query_cache_limit }}
+{% if mariadb_query_cache_type == '0' %}
+query_cache_size = 0
+{% else %}
+query_cache_size = {{ mariadb_query_cache_size }}
+{% endif %}
+
 # Single server setup
 server-id       = 1