dptr1988 Posted June 22, 2006 Share Posted June 22, 2006 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 Quote Link to comment Share on other sites More sharing options...
Wildbug Posted June 22, 2006 Share Posted June 22, 2006 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. Quote Link to comment Share on other sites More sharing options...
dptr1988 Posted June 22, 2006 Author Share Posted June 22, 2006 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.