renaming the database
6 answers - 91 bytes -

Hi,
Is there a command for renaming a MySQL database?
Thank you.
Teddy
No.1 | | 470 bytes |
| 
Rasnita wrote:
Is there a command for renaming a MySQL database?
Sorry, there is no command for that. For small databases you can use
administration tools like phpMyAdmin, etc. which will do it for you by
duplicating the database structure and data, and then drop the 'old'
database. For big databases this will take quite long, so it's probably
better to stick with the old name (what's in a name? ;-) )
Regards, Jigal.
No.2 | | 931 bytes |
| 
Thanks. I want to rename the database in order to keep it as a backup, then
to temporarily create a new one with the same name as a test, because more
programs use that database name.
Teddy
Message
From: "Jigal van Hemert" <jigal (AT) spill (DOT) nl>
To: " Rasnita" <orasnita (AT) fcc (DOT) ro>
Cc: <mysql (AT) lists (DOT) mysql.com>
Sent: Monday, 17, 2005 12:11 PM
Subject: Re: renaming the database
Rasnita wrote:
Is there a command for renaming a MySQL database?
Sorry, there is no command for that. For small databases you can use
administration tools like phpMyAdmin, etc. which will do it for you by
duplicating the database structure and data, and then drop the 'old'
database. For big databases this will take quite long, so it's probably
better to stick with the old name (what's in a name? ;-) )
Regards, Jigal.
No.3 | | 895 bytes |
| 
What about renaming the folder indicating the database name.
I work with Windows XP and renaming a folder works well.
Regards, Cor
Message
From: "Jigal van Hemert" <jigal (AT) spill (DOT) nl>
To: " Rasnita" <orasnita (AT) fcc (DOT) ro>
Cc: <mysql (AT) lists (DOT) mysql.com>
Sent: Monday, 17, 2005 12:11 PM
Subject: Re: renaming the database
Rasnita wrote:
>Is there a command for renaming a MySQL database?
Sorry, there is no command for that. For small databases you can use
administration tools like phpMyAdmin, etc. which will do it for you by
duplicating the database structure and data, and then drop the 'old'
database. For big databases this will take quite long, so it's probably
better to stick with the old name (what's in a name? ;-) )
Regards, Jigal.
No.4 | | 514 bytes |
| 
C.R. Vegelin wrote:
What about renaming the folder indicating the database name.
I work with Windows XP and renaming a folder works well.
Cor,
Have you tried it with InnoDB tables or anything other than MyISAM
tables? InnoDB uses a single tablespace per server (unless specified
that it should use a file per table, but then it still uses a general
tablespace), so renaming a directory or folder will probably only
confuse InnoDB and prevent it from starting.
Regards, Jigal.
No.5 | | 701 bytes |
| 
I think you can just rename the directory that that database lives in.
If you read the documentation for CREATE DATABASE in dev.mysql.com,
you'll see they discuss renaming the directory (although it does not
directly say this can be done to rename the database, but it comes
really close to that.) Based on the documentation the database name is
simply a directory name, no more and no less.
Renaming tables has its own command syntax, you can look it up.
Bob Cochran
Rasnita wrote:
>Hi,
>
>Is there a command for renaming a MySQL database?
>
>Thank you.
>
>Teddy
>
>
>
No.6 | | 257 bytes |
| 
Hello.
This is a frequently asked question. See:
For more solutions search in the archives at:
http://lists.mysql.com
Rasnita wrote:
Hi,
Is there a command for renaming a MySQL database?
Thank you.
Teddy