MySQL – Modify table name by command line

Phpmyadmin is a very good graphic interface to operate data in the database. But have you ever met the case that you want to modify the name of your table, but you don’t want to delete the whole data in the table and recreate a new table and insert data and …

Perhaps, it will block you somewhere. The more operations, the more mistakes. Believe me !

What will you will do now is like the following [In linux or MAC] :

Open a terminal, and type your command:

## enter into mysql ##

# mysql -uroot -pyourpassword (change “root” and “yourpassword” with your own login and password)

## modify the table name ##

# RENAME TABLE tablename TO newtablename (“tablename” is the older table which you want to modify)

Ok, we got it! Refresh your phpmyadmin, you will see the table name changed.

[In window]

Don’t be to lazy to find out the command in CMD. 😉



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s