Rename table in MYSQL

mysqldump - mysql backup
mysqldump – mysql backup

 

To rename a table in MySQL you just need to run a command named RENAME TABLE, the syntax is very easy to use.

RENAME TABLE table1 TO table2;

The RENAME TABLE command will rename the table atomically, which means your table will be locked during the command.

You can also rename more than one table in one command:

RENAME TABLE table1 TO table2, table3 TO table4;

To rename the table you will need ALTER and DROP privileges on the old table and CREATE and INSERT on the new one.

Leave a Reply