MySQL - How to modify a column to become Nullable?

Using SQL Query:

Columns are nullable by default, so for an existing column with NOT NULL defined, you just have to modify it, put in the same data type but remove the NOT NULL part:

ALTER TABLE table_name MODIFY col_name data_type;

Or use CHANGE:

ALTER TABLE table_name CHANGE col_name col_name data_type DEFAULT NULL;

DEFAULT NULL is optional.

Using TablePlus GUI Tool:

  • From the table view, switch to the table structure at the bottom
  • Select the column you want to modify
  • Set is_nullable to YES
  • Remember to hit Cmd + S to commit changes to the server
Modify column in TablePlus GUI Tool MySQL

TablePlus is a native client for MySQL, PostgreSQL, SQLite, Microsoft SQL Server, and other databases. You can keep several databases open at once.

Download TablePlus free.

TablePlus GUI Tool MySQL

← All posts