如何使用MySQL更改数据库名称? [英] How do I change the database name using MySQL?

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

问题描述

如何更改数据库的数据库名称?

How can I change the database name of my database?

我试图使用重命名数据库命令,但是在有关它的文档上,据说使用它很危险.那我该怎么做才能重命名我的数据库名称?

I tried to use the rename database command, but on the documents about it it is said that it is dangerous to use. Then what should I need to do to rename my database name?

例如,如果我想将数据库重命名为此.

For example, if I want to rename my database to this.

database1 -> database2?

推荐答案

我认为这是不可能的.

I don't think it's possible.

您可以使用mysqldump转储数据,然后使用您的新名称创建架构,然后将数据转储到该新数据库中.

You can use mysqldump to dump the data and then create a schema with your new name and then dump the data into that new database.

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

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