"Jesse Castleberry" <[EMAIL PROTECTED]> wrote on 11/07/2005 01:31:54 PM:
> How can I rename a database in MySQL 5? I've tried renaming he folder, and > that just causes other problems. Some one sent me a stored procedure to > try, but it will not execute. There are probably several places that need > to be changed, but I don't know where those are. Could someone point me in > the right direction? > > Thanks, > Jesse > There is no command to RENAME DATABASE in MySQL. However you can create a new, empty database and populate it with data 2 ways: A) rename all of the table so that their name becomes newdatabase.tablename B) Dump and restore the tables from one database into another (see: mysqldump) There is sort of a third option: CREATE TABLE newdatabase.tablename SELECT * from olddatabase.tablename; But that will not move any indexes or foreign keys or anything else but the column definitions and data so it really isn't a good option for what you wanted to do. Shawn Green Database Administrator Unimin Corporation - Spruce Pine