How can I change case of database name in MySQL?

前端 未结 6 919
迷失自我
迷失自我 2021-02-04 03:12

My Database name is SPM and I want to change it to spm (small letters).

I tried using

RENAME DATABASE SPM TO spm;
6条回答
  •  野性不改
    2021-02-04 03:54

    There is no database command to do it. You basically have to do it outside the database. Below are some references outlining possible solutions. It has been answered pretty good in this question

    This is probably what it should look like in your case

    mysqladmin create spm
    mysqldump SPM | mysql spm
    

    After you have verified that everything is in order you can drop the original database.

    drop database SPM
    

    References Rename database 1 / Rename database 2

    [Note on "RENAME DATABASE" command: This statement was added in MySQL 5.1.7 but was found to be dangerous and was removed in MySQL 5.1.23.]

提交回复
热议问题