0

I am trying to create a database with a '-' in between two words and it should work perfectly fine but it isn't. here is the log file:

mysql> create database test1;
Query OK, 1 row affected (0.00 sec)

mysql> show databases
    -> ;
+-----------------------+
| Database              |
+-----------------------+
| information_schema    |
| mifos                 |
| mifosplatform_tenants |
| mifostenant           |
| mifostenant_default   |
| mysql                 |
| performance_schema    |
| sakila                |
| test                  |
| test1                 |
| testing               |
| world                 |
+-----------------------+
12 rows in set (0.00 sec)

mysql> create database test1-mohit;
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 '-mohi
t' at line 1
1
  • can not use of hyphen in database name Commented Apr 20, 2013 at 4:11

2 Answers 2

1

you can use _(underscore)

create database test1_mohit;

or try this

  create database `test1_mohit`;

These both will work

Sign up to request clarification or add additional context in comments.

Comments

0

Use one of these character for naming database [0-9,a-z,A-Z$_]

Reference: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.