Renaming a table in MySQLRenaming a table in MySQL

Posted July 2nd, 2008 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.

resetting the mysql auto increment value with phpmyadmin

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.

Related posts:

Share or Bookmark

Share or Bookmark this page using the following services. You will need to have an account with the selected service in order to post links or bookmark this page.

Subscribe or Follow

Subscribe via RSS or email, or follow me on Facebook or Twitter below. The RSS icon takes you through to Feedburner where you can select the service or application to use.

Comments

blog comments powered by Disqus