Jan 272010
How to rename database in MySQL
Answer:
If you are using MyISAM storage engine, the easiest way is to take down the MySQL server and rename the database folder name.
Else, you can use the mysqldump tool, steps as following:
1. Export the database using mysqldump tool
# mysqldump -u root -p old_db > old_db.sql
2. Create a new database
# mysql -u root -p -e 'create database new_db'
3. Finally import into the new database
# cat old_db.sql |mysql -u root -p new_db