Hi
1- Is there a command to rename an existing database ?
2- If not, how does one create a new database from an existing database ?
could you show me the steps?
To my knowledge, there is no MySQL query which will rename a database.
Since with MySQL a database maps to a directory on the filesystem, one shortcut workaround is to create a new empty database, then copy the files from the old database's directory into the new database's directory.
Here's the gotchas:
1. I strongly recommend that you have MySQL shut down for the copy operation.
2. You need to make sure that the permissions on the copied files are correct. You haven't specified your OS, but on Linux the files must be owned by the user and group as which MySQL runs, with permissions 660.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.