Home  >  Article  >  Database  >  How to modify the table name in mysql?

How to modify the table name in mysql?

little bottle
little bottleOriginal
2019-04-28 17:53:1139917browse

How to modify the table name in mysql?

This article will tell you how to quickly modify the mysql table name. Friends who have the same needs can learn from it. I hope it will be helpful to you after reading it.

Mysql method to modify the table name:

Specific steps: Open cmd->Enter "mysql -u root -p"->Enter password , enter mysql->Enter "alter table rename to/as new_tablename;"

The following code includes the process of creating a table:

#创建表结构.这样的建表方式,不仅仅是表的结构,连带着索引也会同时创建.
mysql> create table ts01 like ti_o_sms; 
Query OK, 0 rows affected (0.02 sec)

#修改表名的语法:alter table old_tablename rename to/as new_tablename;
mysql> alter table ts01 rename to ts01_new;
Query OK, 0 rows affected (0.00 sec)

mysql> show tables;                      
+--------------------+
| Tables_in_mytest   |
+--------------------+
| sms_send_blacklist |
| td_b_sendobject    |
| ti_o_sms        |
| ts01_new        |
+--------------------+
rows in set (0.00 sec)

Related tutorials:mysql video tutorial

The above is the detailed content of How to modify the table name in mysql?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn