Pages

Friday, February 16, 2024

All the databases are showing size 0 MB in cpanel

When managing a server with cPanel, encountering an issue where all databases are showing as 0 MB in size can be concerning. This typically indicates a configuration issue rather than actual data loss. The solution involves a simple tweak in the cPanel configuration file and running a script to update the database cache. Here's a step-by-step guide to resolve this problem:

Step 1: Access the Server

First, you need to access your server's command line interface (CLI). This is usually done via SSH. Once logged in as the root user, you're ready to proceed to the next step.

Step 2: Edit the cPanel Configuration File

The cPanel configuration file, cpanel.config, contains various settings that control how cPanel behaves. To edit this file, you'll use the vi editor, a widely-used text editor in Unix-like operating systems. The command to open the file is:vi /var/cpanel/cpanel.config

Step 3: Modify the Configuration

While in the vi editor, you're looking to change the setting that includes database sizes in the disk usage calculations. By default, or due to a misconfiguration, this setting might be disabled (set to 0). You need to find the line that reads:
disk_usage_include_sqldb=0
and change it to:
disk_usage_include_sqldb=1

This change tells cPanel to include SQL database sizes in its disk usage calculations.

To edit in vi:
Navigate to the line using the arrow keys.
Press i to enter insert mode.
Make the necessary changes.
Press Esc to exit insert mode.
Type :wq and press Enter to save the changes and quit vi.

Step 4: Run the Update Script

After saving the changes to the cpanel.config file, you'll need to update the cPanel database cache. This is done by running a script included with cPanel:/scripts/update_db_cache


This script will process the change you've made and update the database sizes accordingly.
Conclusion

Following these steps should resolve the issue of databases showing as 0 MB in size within cPanel. It's a straightforward fix that addresses a common configuration oversight. After running the update script, you can verify the changes by checking the disk usage statistics in cPanel again. If the problem persists, it might be wise to consult with cPanel's documentation or reach out to their support for further assistance.

No comments:

Post a Comment