Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR 1064 (42000) when creating database in mysql

Tags:

mysql

in mysql interactive terminal, when I want to create a new database

mysql> create database albedo-new;
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 '-new' at line 1

I'm not sure whether mysql allow '-' in a database name.

like image 643
Joe Lu Avatar asked Jul 05 '17 02:07

Joe Lu


1 Answers

mysql does allow hyphens in database names

use backticks

create database `albedo-new`
like image 146
Tik Avatar answered Sep 29 '22 08:09

Tik