|
| |||||||||
| Tags: command, database, mysql, rename mysql database, syntax |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Rename mysql database
Does any one know the command to rename mysql database. I have created a database with name database1 and now i want to convert or change that name in to database2. What are syntax use in mysql to change the database name. I have tried to change that from command Code: rename database database TO database1 |
|
#2
| |||
| |||
| Re: Rename mysql database
If you're renaming the DB by command line, you'll want to grant user permissions to the new DB and delete permissions granted for the old DB.you can just rename the folders that store the databases while the server is. But that doesn't work when you have at least one InnoDB table, because renaming folders wrecks the tablespace. But that does not work when you have at least one InnoDB tableYou either run an SQL query to do this or do it with phpMyAdmin if you don't want to bother remembering the SQL to do so. |
|
#3
| ||||
| ||||
| Re: Rename mysql database
Use the following code to rename mysql database Code: mv databse databse1 cd database/ mv databse.frm database1.frm mv databse.MYD database1.MYD mv databse.MYI databse1.MYI Restart MySQL /etc/init.d/mysql start |
|
#4
| |||
| |||
| Re: Rename mysql database
MySQL does not support a database rename command. If MySQL has no command for renaming a database then the safest way is to use mysqldump to back up the old database, then restore the dump. Using mysqldump, dump the database. The mysqldump client can be used to dump a database or a collection of databases for backup or for transferring the data to another SQL server. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Rename mysql database" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need MySQL database directory | Osman84 | Software Development | 4 | 27-02-2010 05:18 AM |
| Mysql Error : Can't connect to local mysql server through socket ' var lib mysql mysql.sock' 2 | roshan45 | Software Development | 3 | 07-11-2009 09:36 PM |
| How to add mysql database to localhost? | gazwsx | Software Development | 3 | 01-07-2009 08:07 PM |
| Restoring MySQL database | Sean J | Software Development | 5 | 18-02-2009 01:46 PM |
| How to Connect MySQL database from PHP | Booth | Software Development | 3 | 21-01-2009 09:12 PM |