SQL Rename Database

When you want to rename the database then firstly check new database name should not exist.

Syntax:-

RENAME DATABASE oldDatabaseName TO newDatabaseName

Example:-

Suppose you have database employee_management and you want to change the name to employee_system and you want to use below command

RENAME DATABASE employee_management TO employee_system

Now, you can check the database name is changed through below command

SHOW DATABASES

Output:-

employee_system