“Rename” database name in MySQL

April 28, 2007 on 11:01 am | In MySQL |

Currently, there is no method to rename database name in MySQL, but you could easily use  mysqldump command backup  your database and then read it back in to a new database.

Step 1 Dump the database structure and content:

  mysqldump -u username -p dbname >> dump.sql

Step 2 Create a new empty database.
 
 
mysql -u username -p dbname
  mysql> create database newdbname;

Step 3 Reload the database into a new database with a different name:

  mysql -u username -p newdbname < dump.sql

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Since May 6,2007 We have Visitors
dog ramps

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^