Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
130 views
in Technique[技术] by (71.8m points)

mysql - How to change sql database name using sql query?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

MS SQL Server: ALTER DATABASE "old_name" MODIFY NAME = "new_name"

MySQL: While there used to exist a simple RENAME DATABASE command in older versions of MySQL which was intended to perform this task, RENAME DATABASE has since been removed from all newer versions to avoid security risks.

Your option is either to dump and reimport the database or to create a new one and move the tables.

There are other options for MySQL and other types too.
Please do a search.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...