rename mysql table


Rename a table in mysql

RENAME TABLE tbl_name TO new_tbl_name [, tbl_name2 TO new_tbl_name2];
--- Done left to right, so to swap two tables, use a tmp table:
RENAME TABLE old_table TO tmp_table,
             new_table TO old_table,
             tmp_table TO new_table;
--- Actual case: adjust drupal table names for shared tables.
rename table users to shared_users;
rename table sessions to shared_sessions;
rename table role to shared_role;
rename table authmap to shared_authmap;

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.