1

I am developing a web project using Java and MySQL. I am using Mysql Workbench. I started the work but now I need to change the database name. I tried

ALTER DATABASE Test MODIFY NAME = NewTest

and

USE master
GO
ALTER DATABASE Test
SET SINGLE_USER 
WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE Test MODIFY NAME = NewTest
GO
ALTER DATABASE NewTest
SET MULTI_USER 
GO

But these two are showing syntax error. What is the proper way to change database name in MySQL?

4

2 回答 2

1

在 MySQL 中重命名模式是不可能的。有关正确的 ALTER SCHEMA 语法,请参阅在线手册

于 2013-08-08T08:11:37.070 回答
0

我从 Microsoft Windows 命令提示符运行此代码:

cd %ProgramFiles%\MySQL\MySQL 服务器 5.6\bin

mysqldump -u username -p -v olddatabase > olddbdump.sql
mysqladmin -u username -p create newdatabase
mysql -u username -p newdatabase < olddbdump.sql
于 2014-08-06T21:02:02.633 回答