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.

 

Related Posts

  • 47
    Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR) Message: %s near '%s' at line %d Error #1064 means that MySQL can't understand your command. To fix it: Read the error message. It tells you exactly where in your command MySQL got confused. Check the manual. By comparing against what MySQL expected at that…
    Tags: mysql, tutorial
  • 47
    Welcome to the MySQL Knowledge Base and Tutorial  
    Tags: mysql, tutorial
  • 45
    Terminology/Files Driver - A compiled module containing database specific code that accepts the generalized function calls that RealTime makes. As of this writing, only ODBC, MySQL (via asterisk-addons) and LDAP (see http://free.oxymium.net/Asterisk/ and http://bugs.digium.com/view.php?id=5768) drivers are available. Family - A name associated with a RealTime call. Examples: sippeers, sipusers, voicemail.…
    Tags: mysql, table
  • 43
    Running and Shutting down MySQL Server: First check if your MySQL server is running or not. You can use the following command to check this: ps -ef | grep mysqld If your MySql is running, then you will see mysqld process listed out in your result. If server is not…
    Tags: mysql, table
  • 43
    Error: 1008 SQLSTATE: HY000 (ER_DB_DROP_EXISTS) Message: Can’t dropp database ‘%s’; database doesn’t exist  
    Tags: mysql, tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: