ERROR 1026 (ER_ERROR_ON_WRITE) occurs when MySQL cannot write to temporary, log, or data files. This is typically caused by insufficient disk space, missing file permissions, or a read-only filesystem. Fixing the underlying filesystem issue resolves the error.
MySQL Error 1026 is a critical file system error that occurs when the MySQL server attempts to write data to a file and the operating system blocks the operation. The error message format includes the filename and an errno value that indicates the specific OS-level problem. Common errno values include 28 (disk full), 13 (permission denied), 2 (file not found), and 30 (read-only filesystem). This error can occur when writing binary logs, temporary query results, table data, or other critical files. If the MySQL master cannot write binary logs, replica servers will lag or stop replicating entirely until the issue is resolved.
Run the disk usage command to identify space issues:
df -hLook for the mount point containing your MySQL data directory (typically /var/lib/mysql or /data). If "Use%" shows 100% or very close (95%+), disk space is the problem. You must free up disk space or expand the volume before continuing.
To free space:
- Delete old binary logs: mysql -u root -p -e "PURGE BINARY LOGS BEFORE DATE_SUB(NOW(), INTERVAL 7 DAY);"
- Remove old temporary files: rm -f /tmp/mysql*
- Check for large tables that can be archived or truncated
Check that the mysql system user owns the data directory:
ls -la /var/lib/mysql | head -5The output should show "mysql mysql" as owner/group. If not, fix permissions:
sudo chown -R mysql:mysql /var/lib/mysql
sudo chmod -R 750 /var/lib/mysqlOn Windows or custom paths, ensure the MySQL service account (usually "MySQL80" or similar) has full control over the data directory through file properties.
List mounted filesystems to identify read-only mounts:
mount | grep -E "ro|rw"If the MySQL data directory is mounted with "ro" (read-only), remount it as read-write:
sudo mount -o remount,rw /var/lib/mysqlOr remount the entire filesystem:
sudo mount -o remount,rw /A read-only filesystem often indicates a hardware issue, kernel panic, or filesystem corruption. Check system logs after remounting:
sudo dmesg | tail -20Find your MySQL temp directory:
mysql -u root -p -e "SHOW VARIABLES LIKE 'tmpdir';"Check that the tmpdir path exists and is writable by the mysql user:
sudo ls -la /tmp/mysql
sudo chmod 1777 /tmpIf using a custom tmpdir, ensure it has sufficient free space and proper ownership. For containerized MySQL, verify your Docker volume or container tmpfs has adequate space.
Check the MySQL error log for detailed error information:
sudo tail -100 /var/log/mysql/error.log | grep -A 2 "1026"The error message format is: "ERROR 1026: Error writing file 'filename' (errno: XX - description)"
Common errno values:
- errno 28: No space left on device (disk full)
- errno 13: Permission denied
- errno 2: No such file or directory
- errno 30: Read-only file system
Address the specific errno according to the cause identified above.
After fixing filesystem issues, restart the MySQL service:
sudo systemctl restart mysqlOr on older systems:
sudo /etc/init.d/mysql restartMonitor the error log during startup:
sudo tail -f /var/log/mysql/error.logIf replication is enabled, wait for the replica to catch up to the master before resuming application traffic:
mysql -u root -p -e "SHOW SLAVE STATUS\G" | grep "Seconds_Behind_Master"For replicated environments: If this error occurs on the master, all replicas will stop replicating and lag indefinitely until the master can write binary logs again. Prioritize fixing this on masters. On replicas, the error usually indicates a problem with the relay log directory or applier temp files.
Container-specific issues: Docker containers and Kubernetes pods often have limited tmpfs space (/tmp). If MySQL creates large temporary tables, they may fail with errno 28. Increase container memory limits or configure MySQL to use a persistent volume for tmpdir.
Cloud storage considerations: When using block storage (EBS, GCP Persistent Disk, Azure Managed Disks), I/O throttling or network disconnection can manifest as error 1026. Check cloud provider metrics and increase IOPS limits if needed.
Windows-specific note: On Windows, FAT32 volumes cannot exceed 4GB per file. If using FAT32 storage for MySQL, upgrade to NTFS. Also check User Account Control (UAC) if the MySQL service lacks admin privileges.
Binary log issues: If the error specifically mentions 'binlog', ensure the binlog directory exists and is writable. Binlog corruption may require rebuilding replication from a fresh backup.
EE_WRITE (3): Error writing file
How to fix "EE_WRITE (3): Error writing file" in MySQL
CR_PARAMS_NOT_BOUND (2031): No data supplied for parameters
How to fix "CR_PARAMS_NOT_BOUND (2031): No data supplied for parameters" in MySQL
CR_DNS_SRV_LOOKUP_FAILED (2070): DNS SRV lookup failed
How to fix "CR_DNS_SRV_LOOKUP_FAILED (2070): DNS SRV lookup failed" in MySQL
ERROR 1146: Table 'database.table' doesn't exist
How to fix "ERROR 1146: Table doesn't exist" in MySQL
ERROR 1040: Too many connections
How to fix "ERROR 1040: Too many connections" in MySQL