Magento disable cache from database

Magento disable cache from database

July 24, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento disable cache from database

Disabling Magento Cache via Database Queries

In high-pressure e-commerce environments, you might need to disable cache in your Magento store without accessing the admin interface. This is particularly useful when the admin panel is down or you’re working remotely on the database level. To achieve this, we’ll use SQL queries directly against the Magento database.

Understanding Magento Cache Configuration

Before diving into SQL queries, it’s crucial to understand how Magento manages its cache. By default, Magento stores its configuration data in the core_config_data table. The cache-related configurations are stored under the path system/cache.

The primary configuration for enabling/disabling cache is located at:

SELECT * FROM core_config_data WHERE path = 'system/cache/enabled'

Disabling Cache Using SQL Query

To disable the entire Magento cache system via an SQL query, you need to update this specific record in the core_config_data table. The value field must be set to 0 (zero).

Here’s a simple SQL query that disables all caching:

UPDATE core_config_data SET value = 0 WHERE path = 'system/cache/enabled'

Disabling Specific Cache Types

If you only want to disable certain types of cache—such as block HTML output or layout XML—the process is similar but requires updating the corresponding paths.

For example, to disable the block HTML output cache:

UPDATE core_config_data SET value = 0 WHERE path = 'system/cache/block_html'

To disable layout XML cache:

UPDATE core_config_data SET value = 0 WHERE path = 'system/cache/layout_xml'

Flushing Cache Tables

After updating the configuration, you’ll need to flush the actual cache data from the database. This is done by emptying (or truncating) several tables.

The main tables that store cached data are:

  • cache_core_options
  • cache_block_html
  • cache_layout

To flush all these tables simultaneously using a single SQL command, you can use this query:

TRUNCATE TABLE cache_core_options;
TRUNCATE TABLE cache_block_html;
TRUNCATE TABLE cache_layout;

Caution When Disabling Cache

While disabling cache is necessary in certain situations—such as during development or when optimizing performance—it’s important to note the following precautions:

  1. Performance Impact: With caching disabled, your server will experience a significant performance hit due to the increased database load.

  2. Security Implications: Some Magento security features rely on cached data. Disabling cache might expose potential vulnerabilities.

  3. Data Integrity: Cached data is often used by third-party extensions or custom code. Disrupting this can lead to unpredictable behavior across your site.

Conclusion

Disabling Magento cache via SQL queries provides a powerful, albeit risky, method for managing your e-commerce store’s caching system directly at the database level. Remember that this should be used sparingly and only when necessary—particularly in development environments or during emergency situations where admin access is unavailable.

Before applying any of these changes, make sure to backup your data first. It’s always recommended to work with a staging environment before implementing changes on a live site.

For more advanced Magento database management techniques and best practices, consider exploring the resources available at Laravel Company.

Cache Database Themes Admin

Our network