Hi,
Is there any way I can rename a database just like you rename a table? I need to be able to rename it without loosing my tables and data.
Thanks,
Justin Sampson
Printable View
Hi,
Is there any way I can rename a database just like you rename a table? I need to be able to rename it without loosing my tables and data.
Thanks,
Justin Sampson
There is no explicit command to migrate one database to another.
You could dump your tables and data to text files. Create your new database and import the tables and data. Once everything is working good then you can delete the original table.
In the win32 version, you can rename the database simply by renaming the respective folder in <mysqldir>\data
I have tested this and it seems to work fine. You could try this in the linux version aswell (which I presume you have), but stop mysql before you do this.
You also might want to take a backup ;)
Thanks guys!
W. Luke's methed worked perfect :)
as for mysql, i think adding appropriate permission settings and just renaming the database directory works fine too.. i've not done THAT exactly, but i've done similar stuff, so dont quote me on that ;)
--------------------
SitePoint Community Advisor
myPHPhost: hey, PHP all the way babyee
Renaming the directory does indeed work just fine, but you'll need to update your permissions if you have any assigned to that particular database.