Home / MySql / Renaming a table in MySQL

Renaming a table in MySQL

Sometimes you need to rename a table in MySQL. You either run an SQL query to do this or do it with phpMyAdmin if you don’t want to bother remembering the SQL to do so. This post looks at how to rename a table  in MySQL either with a SQL query or using phpMyAdmin.

The example SQL below renames the MySQL table “tablename” to “tablename_renamed”:

RENAME TABLE tablename TO tablename_renamed

To rename a MySQL table with phpMyAdmin, select the database then table, and click the “Operations” tab. Then put the new name into the text box labelled “rename table to” and click the “Go” button. The relevent buttons etc are highlighted with red circles in the screenshot below.

After clicking the “Go” button the table will be renamed and the same page as shown above will be loaded again, showing the rename query that was executed.