How to reference a table called `\` (simply just backslash character) in MySQL in a query? Through some unknown circumstances I have a table called "\" in a database.

mysql&gt; show tables like '\\';
+-----------------------------+
| Tables_in_in_realestate (\) |
+-----------------------------+
| \                           |
+-----------------------------+


On the disk the files are called @005c.

user@host:mysql/database/$ ls @005c.*
@005c.frm  @005c.ibd


I want to rename it to something more manageable, but I can't reference it in a RENAME TABLE query.

mysql&gt; RENAME TABLE `\` TO `backslash`
    `&gt; `          &lt;-- it thinks there is an open quote
    -&gt; \c         &lt;-- so I just cancel the query


I thought I could escape the "\" with another "\" but that doesn't seem to work either:

mysql&gt; RENAME TABLE `\\` TO `backslash`;
ERROR 1017 (HY000): Can't find file: './in_realestate/@005c@005c.frm' (errno: 2 - No such file or directory)


How can I reference the table in my RENAME TABLE query?
Somehow this query actually works...

RENAME TABLE `\` TO backslash; `;


Two statements, three backticks in total - neither statement would work by itself but somehow together they do the job. Despite giving an error.

To test this in a vacuum you can do:

mysql&gt; show tables;
Empty set (0.00 sec)

mysql&gt; CREATE TABLE `\` ( `foo` int(10) ) ENGINE=InnoDB CHARSET=utf8; `;
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): 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 '`' at line 1
mysql&gt; show tables;
+---------------+
| Tables_in_foo |
+---------------+
| \             |
+---------------+
1 row in set (0.00 sec)

mysql&gt; DROP TABLE `\`; `;
Query OK, 0 rows affected (0.00 sec)

ERROR 1064 (42000): 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 '`' at line 1
mysql&gt; show tables;
Empty set (0.00 sec)


Please note that the syntax for this command is quite peculiar: it is the word "DROP" followed by "TABLE" followed by the string "\; `;" - that is backtick, then backslash, backtick again and then semi-colon. This is further followed by space, then (another) backtick and finally semi-colon.