Error writing file (errno: N)
Production Risk
High — writes are failing; data may not be persisted.
ER_ERROR_ON_WRITE (1026, SQLSTATE HY000) is raised when MySQL cannot write to a data or temporary file. The accompanying errno (e.g. 28 = no space, 13 = permission denied) identifies the OS-level cause.
- 1Disk is full (errno 28)
- 2MySQL process lacks write permission on the data directory (errno 13)
- 3File system errors or a failing disk
-- Occurs during writes when underlying OS write call fails
expected output
ERROR 1026 (HY000): Error writing file '/tmp/#sql_tmp' (errno: 28 - No space left on device)
Fix
Resolve the OS-level error indicated by errno
WHEN Always — match the errno to its OS meaning.
-- errno 28: free disk space or expand the volume -- errno 13: fix directory ownership: -- chown -R mysql:mysql /var/lib/mysql
Why this works
The errno value maps directly to a POSIX error code; resolving the OS condition clears the MySQL error.
✕ Retry the write without fixing the underlying OS error
Retries will continue to fail until the root cause (disk full, permissions) is resolved.
MySQL 8.0 — 1026 ER_ERROR_ON_WRITE
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev