Renaming a Database in Mysql

From the easy way to the crazy way here is how to rename a Mysql Database.

1. Using phpMyAdmin
Log into your phpMyadmin select the database that you want to rename and click on the Operations tab

2.   You can use mysqldump (This is the one I use or very large databases)

mysqldump -u username -p -v SourceDB > SourceDB.sql
mysqladmin -u username -p create  NewDB
mysql -u username -p NewDB < SourceDB.sql

3.  Create a new database and migrate all the tables from the old one to the new one.

4.  The Crazy Option

Shutdown the MYSQL Database
Locate the location where MYSQL save the databases. (ususally they are located in /var/lib/mysql/ on a Linux platfrom)
Rename All Old database Files to new Database filenames (something like mv olddb.* to Nename.*)
Restart The Database
Make sure you check the Grant permission.
Let's share thisShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn