Jump to content

Archived

This topic is now archived and is closed to further replies.

dptr1988

Trouble with RENAME DATABASE syntax

Recommended Posts

I'm trying to rename on of my databases called 'site_info' to 'dptr1988'. So I'm using this command:
[code] RENAME DATABASE site_info TO dptr1988; [/code] But I get a syntax error saying this: [code]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATABASE site_info TO dptr1988' at line 1[/code] Is the syntax of my rename command correct?

Thanks

Share this post


Link to post
Share on other sites

AfaIk, there's no "RENAME DATABASE" command in MySQL. You'll have to do it in a multi-step process. Either export the database and use the backup to create a new database with the new name or shutdown MySQL and rename the directory/table files if you have filesystem permissions to do so. Remember, if you have users with privileges on the old db name, you'll have to update those privileges, too.

Share this post


Link to post
Share on other sites
Thanks for pointing that out to me. I was very dumb!! The manual said "RENAME TABLE" and somehow my brain saw "RENAME DATABASE". Thanks for helping me!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.