sam
sam

Reputation: 10094

Deleting mysql db syntax?

Im trying to tidy up my local dbs which are left over duplicates and dev dbs from past projects.

To do it im viewing in Sequel pro, then im deleting them using the command DROP DATABASE testdatabase; that works fine.

But some of my dbs have names like lorem-blog-db (with dashes) when i try to run DROP DATABASE lorem-blog-db; it gives me back an error near 'lorem-blog-db'.

Any idea how to resolve this ? i guess its to do with the dashes.

Upvotes: 0

Views: 43

Answers (1)

O. Jones
O. Jones

Reputation: 108806

In MySQL, you can use backticks to escape names. Like so:

DROP DATABASE `my-least-favorite-db`

Upvotes: 2

Related Questions