Renaming a table is not working in MySQL
RENAME TABLE group TO member;
The error message is
RENAME TABLE tb1 TO tb2;
tb1 - current table name. tb2 - the name you want your table to be called.
You can use
RENAME TABLE `group` TO `member`;
Use back tick (`) instead of single quote (').
group
is a keyword (part of GROUP BY) in MySQL, you need to surround it with backticks to show MySQL that you want it interpreted as a table name:
RENAME TABLE `group` TO `member`;
added(see comments)- Those are not single quotes.
group - is a reserved word in MySQL, that's why you see such error.
#1064 - 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 'group
RENAME TO member' at line 1
You need to wrap table name into backticks:
RENAME TABLE `group` TO `member`;
Try any of these
RENAME TABLE `group` TO `member`;
or
ALTER TABLE `group` RENAME `member`;
According to mysql docs: "to rename TEMPORARY
tables, RENAME TABLE
does not work. Use ALTER TABLE
instead."
So this is the most portable method:
ALTER TABLE `old_name` RENAME `new_name`;