Javatpoint Logo

91-9990449935

 0120-4256464

SQL RENAME Database

Sometimes you need to change the name of your databasebecause of the original name was not more relevant to the data. Or, you just want to give a temporary name to that data.

SQL RENAME DATABASE statement is used to change the name of a database.


Let's see how to rename MySql and SQL Server databases.

Rename MySQL database

To rename the mysql database, you need to follow the following syntax:


Rename SQL server database using T-SQL

This command is useful for SQL server 2005, 2008, 2008R2 and 2012.

If you are using SQL server 2000, you can also use this command to rename the database. But, Microsoft phased out it.