Dealing with Dashes in MySQL Database Names

The solution is simple: surround the database name with backticks. Use SHIFT and ~ to create the backtick symbol.

Now you should be able to use the database name how ever you would like.

mysql> CREATE DATABASE foo-bar;
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 '-bar' at line 1
mysql> CREATE DATABASE `foo-bar`;
mysql> DROP DATABASE `foo-bar`;