How can we rename the database name in MySQL 5.0

后端 未结 5 1079
情话喂你
情话喂你 2021-02-07 21:41

I am using MySQL 5.0.

I have created a database named accounts, but now I want to change the database name to FinanceAccounts.

5条回答
  •  自闭症患者
    2021-02-07 22:05

    The best way is probably to rename each of the tables inside the database to the new name. For example:

    Update: There are two steps here

    1. Create a new blank database as you want say "new accounts"

      CREATE DATABASE newaccounts;

    2. Migrate each table one-by-one

      RENAME TABLE accounts.tablename TO newaccounts.tablename;

    See http://dev.mysql.com/doc/refman/5.0/en/rename-table.html for more information.

提交回复
热议问题