search

Home  >  Q&A  >  body text

mysql - 用这种方式重新命名数据库安全吗?

只有数据表,没有视图
1、CREATE DATABASE new_db_name; 创建新的数据库
2、RENAME TABLE db_name.table1 TO new_db_name.table1; 对所有的表进行重命名
3、DROP DATABASE db_name; 删除原来的数据库

阿神阿神2767 days ago483

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 16:37:57

    Um, can you do this? It is better to rename the database name directly.

    If you want to import tables one by one from between two libraries, the standard approach is:

    CREATE TABLE new_db_name.table1 LIKE db_name.table1;
    INSERT INTO new_db_name.table1 SELECT * FROM db_name.table1;

    reply
    0
  • Cancelreply