如何在MySQL中更改数据库名称的大小写? [英] How can I change case of database name in MySQL?

查看:99
本文介绍了如何在MySQL中更改数据库名称的大小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库名称是 SPM ,我想将其更改为 spm (小写字母)。

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

我尝试使用

RENAME DATABASE SPM TO spm;

,但我收到以下错误消息:

, but I am getting the following error message:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATABASE SPM to spm' at line 1

我的服务器版本:5.0.45

推荐答案

做它。你基本上必须在数据库之外。以下是一些可能的解决方案的参考。在此问题中已回答相当不错。

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

参考资料
重命名数据库1 / 重命名数据库2

[有关 RENAME DATABASE 命令:此语句在MySQL 5.1.7中添加,但被发现是危险的,并在MySQL 5.1.23中删除。]

[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.]

这篇关于如何在MySQL中更改数据库名称的大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆