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
https://forums.phpfreaks.com/topic/12661-trouble-with-rename-database-syntax/
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.

Archived

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

×
×
  • 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.