Use phpMyAdmin to change column name and datatype in MySQL

Using the MySQL ALTER TABLE command, you can easily change an existing columns’ name and datatype. With just a few clicks, you can do the same in the phpMyAdmin visual web interface. For many developers, this interface is the one they lean on most while programming so it can’t hurt to know how to do it yourself should you find yourself programming in this environment…


Self-Promotion

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!


Suppose we have a table with these 3 columns:

  • id
  • title
  • grade

Our goal is to rename the title column to paper_title and to also change the datatype from TEXT to VARCHAR(150).

To get started, simply click the checkbox on the far left of the columns’ row you want to change.

phpMyAdmin-table-structure-layout
phpMyAdmin table structure layout.

After checking the checkbox, select the change action (just beside the pencil icon). You are presented with this view of the column and accompanying metadata:

phpMyAdmin-current-column-row-structure
Current column structure…

This section allows you to change the column name, the data type, and if applicable – the Length/Values value (among other metadata that is presented for a column in this view). As you see in the screenshot below, I indeed changed the datatype to VARCHAR and set a Length of 150.

phpMyAdmin-column-row-view-after-edit
Changed column name and datatype…

After clicking the Save button in the far lower right (not shown), you can revisit the overall table Structure tab and see the implemented changes

phpMyAdmin-structure-view-changed-column-metadata
After changing the column name, datatype, and datatype length…

Notice the exact MySQL command is shown just above the table column row metadata. This is the command that was executed to carry out the changes and is a great way to learn what the different actions are when you execute them. Just be extremely careful with any Data Definition Language commands…

Like what you have read? See anything incorrect? Please comment below and thanks for reading!!!

A Call To Action!

Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.

Visit the Portfolio-Projects page to see blog post/technical writing I have completed for clients.

Have I mentioned how much I love a cup of coffee?!?!

To receive email notifications (Never Spam) from this blog (“Digital Owl’s Prose”) for the latest blog posts as they are published, please subscribe (of your own volition) by clicking the ‘Click To Subscribe!’ button in the sidebar on the homepage! (Feel free at any time to review the Digital Owl’s Prose Privacy Policy Page for any questions you may have about: email updates, opt-in, opt-out, contact forms, etc…)

Be sure and visit the “Best Of” page for a collection of my best blog posts.


Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.

Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, is performed on a personal development/learning workstation-environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.

Hey thanks for commenting! Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.