MySQL – Rename Column

A column name may need to change when a database schema is clarified, an application field is renamed, or an earlier name no longer describes the stored data correctly. MySQL supports renaming a column with ALTER TABLE. The preferred statement depends on the MySQL version and whether the column definition must also change.

Rename a column with RENAME COLUMN in MySQL 8.0 and later

In MySQL 8.0 and later, use RENAME COLUMN when only the column name should change. The data type, nullability, default value, comment, and other column attributes remain unchanged.

</>
Copy
ALTER TABLE table_name
RENAME COLUMN old_column_name TO new_column_name;

For example, the following statement renames section to class in the students table.

</>
Copy
ALTER TABLE students
RENAME COLUMN section TO class;

Rename a column with CHANGE in older MySQL versions

For older MySQL versions, or when the name and definition must be changed together, use CHANGE. This form requires the complete new column definition.

To rename a column in MySQL, use the following syntax:

</>
Copy
ALTER TABLE table_name CHANGE old_column_name new_column_name datatype(length);

When using CHANGE, repeat every attribute that should remain on the column. Attributes such as UNSIGNED, NOT NULL, DEFAULT, COMMENT, character set, and collation are not preserved if they are omitted from the new definition.

</>
Copy
ALTER TABLE students
CHANGE section class VARCHAR(20) NOT NULL;

The example above is correct only when the existing section column is intended to remain VARCHAR(20) NOT NULL. Inspect the current definition before constructing a CHANGE statement.

Check the current MySQL column definition before renaming

Use DESCRIBE for a quick view of column names and types. Use SHOW CREATE TABLE when you need the complete definition, including default values, generated expressions, indexes, and constraints.

</>
Copy
DESCRIBE students;
</>
Copy
SHOW CREATE TABLE students;

Example 1 – Rename/change Column Name in MySQL Table

Let us consider a table called students whose schema is given below.

MySQL Describe Table

Now we shall rename the column section to class.

On MySQL 8.0 or later, run:

</>
Copy
ALTER TABLE students
RENAME COLUMN section TO class;

On an older MySQL version, use CHANGE and supply the exact column definition shown by SHOW CREATE TABLE.

MySQL Change Column Name

Let us verify the change with DESCRIBE TABLE query.

</>
Copy
DESCRIBE students;
MySQL Describe table after changing column name

The result should list class instead of section. Renaming the column changes its identifier but does not delete the values stored in that column.

RENAME COLUMN, CHANGE, and MODIFY differences in MySQL

MySQL clauseRenames the column?Changes the definition?Typical use
RENAME COLUMNYesNoChange only the column name in MySQL 8.0 or later.
CHANGEYesYes, if a different definition is suppliedRename a column on older versions or rename and redefine it together.
MODIFYNoYesChange the data type or attributes without changing the name.
RENAME TABLENoNoRename the table itself rather than one of its columns.

For example, the following statement changes the definition of class without renaming it.

</>
Copy
ALTER TABLE students
MODIFY COLUMN class VARCHAR(30) NOT NULL;

Rename a MySQL column and change its data type together

Use CHANGE when the column name and its definition must be changed in one operation. The following example renames section to class and changes its type to VARCHAR(30).

</>
Copy
ALTER TABLE students
CHANGE COLUMN section class VARCHAR(30) NOT NULL;

Review existing values before reducing a column length or changing its data type. A type conversion can fail or alter data when existing values do not fit the new definition.

Rename multiple columns in one MySQL ALTER TABLE statement

Multiple column-renaming clauses can be included in a single ALTER TABLE statement. Each old and new name must be valid in the final table definition.

</>
Copy
ALTER TABLE students
    RENAME COLUMN section TO class,
    RENAME COLUMN student_name TO full_name;

Combining related schema changes can simplify a migration, but test the complete statement before running it on a production table.

Rename a MySQL column that uses a reserved word or special characters

Wrap identifiers in backticks when a table or column name conflicts with a reserved word, contains spaces, or otherwise requires quoting.

</>
Copy
ALTER TABLE `students`
RENAME COLUMN `section` TO `class`;

Clear, conventional identifiers are easier to use than names that require quoting. Renaming a column to a reserved word is generally best avoided.

Rename a column in MySQL Workbench

  1. Open MySQL Workbench and connect to the required server.
  2. In the Schemas panel, expand the database and then expand Tables.
  3. Right-click the table and select Alter Table.
  4. Open the Columns tab and edit the required column name.
  5. Review the generated ALTER TABLE statement before selecting Apply.
  6. Run DESCRIBE table_name after the change to confirm the new column name.

Workbench provides a graphical editor, but the server still performs an ALTER TABLE operation. Check that the generated SQL preserves the intended column definition.

Objects and application code affected by a MySQL column rename

MySQL updates index and foreign-key references that use the renamed column. However, it does not automatically rewrite every dependent SQL object or application query.

  • Update application SELECT, INSERT, UPDATE, and DELETE statements that use the old name.
  • Review views, stored procedures, stored functions, and application-side ORM mappings.
  • Review generated-column and partition expressions that refer to the old column name before running the rename.
  • Update reports, exports, ETL jobs, API payload mappings, and tests that expect the old identifier.
  • Check user privileges and deployment scripts for references to the previous schema.

A column rename is a schema change, so it may wait for metadata locks held by other sessions. On a busy or large table, schedule the operation appropriately and test it with the same MySQL version and storage engine used in production.

Common MySQL column rename errors

ProblemLikely causeCorrection
Syntax error near RENAME COLUMNThe server version does not support that syntax.Check SELECT VERSION() and use CHANGE with the complete column definition when required.
Unknown columnThe old column name is misspelled or the wrong database is selected.Run DESCRIBE table_name and verify the active database.
Duplicate column nameThe requested new name already exists in the table.Choose a unique column name or plan a valid multi-column rename.
Column attributes changed unexpectedlyA CHANGE statement omitted attributes from the original definition.Rebuild the statement from SHOW CREATE TABLE and include every required attribute.
Application query fails after the renameThe query still refers to the old column name.Update dependent SQL, mappings, views, and tests as part of the same deployment.

MySQL column rename FAQs

How do I rename a column in an existing MySQL table?

On MySQL 8.0 or later, run ALTER TABLE table_name RENAME COLUMN old_name TO new_name;. On an older version, use CHANGE and include the complete column definition.

Does renaming a MySQL column delete its data?

No. Renaming changes the column identifier, not the values stored in the column. A separate type change performed with CHANGE or MODIFY may convert data and therefore requires additional review.

Do I need to specify the data type when renaming a MySQL column?

Not with RENAME COLUMN. The CHANGE form requires the complete column definition, including the data type and all attributes that must remain.

Can MODIFY COLUMN rename a column in MySQL?

No. MODIFY COLUMN changes the definition while keeping the same name. Use RENAME COLUMN or CHANGE to change the name.

How do I rename a MySQL table instead of a column?

Use RENAME TABLE old_table_name TO new_table_name; or the table-renaming form of ALTER TABLE. This is different from RENAME COLUMN.

MySQL column rename editorial verification checklist

  • Confirm whether the target server supports RENAME COLUMN.
  • Verify the current definition with SHOW CREATE TABLE before using CHANGE.
  • Preserve nullability, default values, comments, character set, collation, and other required attributes.
  • Confirm that the new column name does not conflict with another column or a reserved word.
  • Review generated columns, partitions, views, stored programs, ORM mappings, and application SQL for the old name.
  • Verify the result with DESCRIBE and run affected application tests after the migration.

Official MySQL ALTER TABLE reference for column renaming

For complete syntax, dependency behavior, privileges, locking, and version-specific DDL rules, refer to the official MySQL ALTER TABLE documentation.