Jump to content

Trouble with RENAME DATABASE syntax


dptr1988

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
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.