MySQL 1021: Disk full.
Debug mysql automatically with DrDroid AI →
Connect your tools and ask AI to solve it for you
What is MySQL 1021: Disk full.
Check the disk space usage:
- Run `df -h` to identify the disk usage and see if the disk is indeed full.
Identify large tables or logs consuming space:
- Connect to the MySQL server: `mysql -u username -p` - Check table sizes: `SELECT tableschema AS "Database", ROUND(SUM(datalength + indexlength) / 1024 / 1024, 2) AS "Size (MB)" FROM informationschema.TABLES GROUP BY table_schema;` - Check binary log usage: `SHOW BINARY LOGS;`
Free up space:
- If logs are consuming space, purge binary logs by executing: `PURGE BINARY LOGS TO 'mysql-bin.010';` (replace `mysql-bin.010` with the name of one of the latest few logs). - If specific tables are identified as large, consider archiving old data and then deleting it from the table: `DELETE FROM table_name WHERE condition;` (ensure to have a backup before doing this).
Optimize tables after cleanup to reclaim space:
- Run `OPTIMIZE TABLE table_name;` for the tables you've cleaned up.Remember to replace `username`, `mysql-bin.010`, `table_name`, and `condition` with your actual MySQL username, the specific binary log file, the actual table names, and the conditions for rows you want to delete, respectively.
Still debugging? Let DrDroid AI investigate for you →
Connect your tools and debug with AI
Get root cause analysis in minutes
- Connect your existing monitoring tools
- Ask AI to debug issues automatically
- Get root cause analysis in minutes