Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Change Table Columns in phpMyAdmin

This guide shows how to rename, change, add or remove a column in a database table using phpMyAdmin.

Databases2 min read20 steps4 screenshots

What is a column?

A database stores information in tables. A table looks like a spreadsheet. Each column is one kind of information, such as a name or an email. Each row is one record.

phpMyAdmin is a web tool for managing MySQL databases. You open it from your hosting control panel, for example from cPanel.

Warning: Changing or deleting a column can break your website and destroy data. Always export a backup of the database first. Do not edit tables of apps like WordPress unless you know why.

Take a backup

  1. Open phpMyAdmin from your control panel.
  2. Click your database in the left list.
    Screenshot: Click your database in the left list.
  3. Click Export, then Go.
  4. Keep the downloaded file safe.

Open the table structure

  1. Click your database, then click the table name.
  2. Click the Structure tab. You see all the columns in a list.

Change a column

  1. Find the column in the list.
  2. Click Change beside it.
    Screenshot: Click Change beside it.
  3. Edit the Name to rename it.
  4. Change the Type if needed. Common types are INT for whole numbers, VARCHAR for short text, TEXT for long text and DATE for dates.
  5. Set the Length/Values. For VARCHAR, this is the most characters allowed, such as 255.
  6. Change Default or tick Null if the column may be empty.
  7. Click Save.

Add a column

  1. On the Structure tab, find the form near the bottom that says Add.
  2. Choose how many columns and where to put them.
  3. Click Go.
  4. Fill in the name, type and length.
  5. Click Save.

Delete a column

  1. Click Drop beside the column.
  2. Confirm when asked. The data in that column is gone for good.

Use SQL instead

Click the SQL tab and run a command. SQL is the language used to talk to databases. This one renames a column:

ALTER TABLE users CHANGE old_name new_name VARCHAR(100);

It changes the column old_name in the table users to new_name, with text up to 100 characters.

Tip: Shrinking a column, for example from 255 to 50 characters, may cut off existing data. Check your data first.

Quick recap

  • Columns are the labelled fields of a table.
    Screenshot: Columns are the labelled fields of a table.
  • Back up the database before any change.
  • Use the Structure tab, then Change or Drop.
  • You can also use the ALTER TABLE command.
  • Changing apps' tables may break them.
    Screenshot: Changing apps' tables may break them.