1026
MySQLERRORCriticalStorageHIGH confidence

Error writing file (errno: N)

Production Risk

High — writes are failing; data may not be persisted.

What this means

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.

Why it happens
  1. 1Disk is full (errno 28)
  2. 2MySQL process lacks write permission on the data directory (errno 13)
  3. 3File system errors or a failing disk
How to reproduce
trigger — this will error
trigger — this will error
-- 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.

Resolve the OS-level error indicated by errno
-- 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.

What not to do

✕ Retry the write without fixing the underlying OS error

Retries will continue to fail until the root cause (disk full, permissions) is resolved.

Sources
Official documentation ↗

MySQL 8.0 — 1026 ER_ERROR_ON_WRITE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors