Inserting Fields into Database Tables with PhpMyAdmin

Reading Time: 2 minutes

When working on a database, we sometimes find that additional data should be added for each record, but will not fit into any of the existing fields or structures. Adding a new column into an existing database can help with this problem, and it is very easy to accomplish with PhpMyAdmin.

This guide assumes that you have already logged in to PhpMyAdmin as the root user. Next, we will go over how to copy a table, and then review a few of the options PhpMyAdmin provides.

Starting on the home page of PhpMyAdmin, click on the database name of the table we want to modify.

10-01-Main_Page

Then, click on the table name.

10-02-Table_Name

This page shows us the existing structure, and in our case, we can see four existing columns:

  • option_id
  • option_name
  • option_value
  • autoload.

To add a new column, click on the Structure tab near the top of the page.

10-03-Table_Structure

The Structure page again shows the existing columns and gives more information on how they are configured. Below that is a section to add one or more columns. First, choose how many columns we want to add, and then, decide where they should be added, relative to the existing fields. In our case, we will add one column after the autoload field, then click on the Go button to proceed.

10-04-Add_Column

Now we can configure the new field. Enter the name of the columns, what type of data it will store, and then any other information we need, like the length, default value, collation type, index type, and other notes. Just the name and type are required, so add those and then click on the Save button.

10-05-Column_Details

The page should say that the table was altered successfully, now navigate back to the table, and we can see the new field has been added to the table!

10-06-New_Column_Added

We can now add data into that field and use it as needed!

Conclusion

PhpMyAdmin makes the process of adding a new column to an existing database table clear and easy to do.

Series Navigation<< Previous ArticleNext Article >>

Author Bio

About the Author: Alex Gorzen

Alex Gorzen has been helping others with technology his whole life. He played with computers even before he could read and wants to make sure his children share that same love as they grow up. In his free time he enjoys gardening, building things, and learning new skills.

Refer a friend and get a $50 hosting credit!