Sunday, March 7, 2010

Rename MySQL Database

1) Open command prompt and invoke Musql with this command
c:\ mysql -u root -p (After login)
mysql> create database
mysql> quite

Now on command prompt:
c:\ mysqldump old_database -u root -p | mysql -D new_database -u root -p
enter password twice and then it will copy the contents from the old database to the new one.

It'll dump out the old database to STDOUT, pipe this to a second MySQL process and insert the dumped data (and schema) to the new DB.

You'll have to manually DROP the old DB and change the permissions on the new DB, but at least you have the data and schema

courtesy: http://www.delphifaq.com/faq/databases/mysql/f574.shtml

No comments:

Post a Comment