MySQL:使用 rename 修改表名


#MySQL 笔记


使用 MySQL 5.7 测试。

示例:

-- 建库
create database test;
use test;

-- 建表
create table `user_info` (
    `id` bigint unsigned not null auto_increment,
    `name` varchar(45) not null default '',
    primary key (`id`)
) engine = InnoDB default charset = utf8mb4;


-- 修改表名
rename table user_info to user_info2;
mysql root@127.0.0.1:test> show tables
+----------------+
| Tables_in_test |
+----------------+
| user_info2     |
+----------------+


( 本文完 )