Monday, March 10, 2014

Mysql: Drop database with dash in name

The issue:
mysql> drop database my-web;
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 '-web' at line 1
mysql> drop database "my-web";
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 '"my-web"' at line 1
mysql> drop database 'my-web';
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 ''my-web'' at line 1
 
The trick:
mysql> drop database `my-web`;
Query OK, 83 rows affected, 1 warning (0,02 sec)

2 comments:

  1. "Thanks for the Information.Interesting stuff to read.Great Article.
    I enjoyed reading your post, very nice share.data science training"

    ReplyDelete
  2. First You got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks.
    Best Institutes For Digital Marketing in Hyderabad

    ReplyDelete