# MySQL ERROR 1048 (23000): Column 'x' cannot be null

**Code:** `1048` · **Category:** MySQL · **Seen on:** MySQL

An INSERT/UPDATE put NULL into a NOT NULL column.

## Meaning

Missing form fields, ORM attributes not set, or explicit NULL from the application.

## Common causes

- Required field missing from input
- ORM model attribute not assigned
- Explicit NULL instead of omitting the column (default not applied)

## Quick fix

1. Validate required fields
2. Provide a default in the schema
3. Omit the column to use its DEFAULT

## Detailed fix by platform

### MySQL

1. `ALTER TABLE users MODIFY status VARCHAR(20) NOT NULL DEFAULT 'active';`

## How to diagnose

1. **Column** — Which one?
2. **Input** — Why is it null?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/mysql/1048-column-cannot-be-null)
