alexus
alexus

Reputation: 7465

mysql numeric database limitation

is there a limitation of database name can't be created as numeric?

mysql> CREATE DATABASE 1;

...results in:

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 '1' at line 1

....or am I doing something wrong?

Upvotes: 2

Views: 515

Answers (2)

Ondra Žižka
Ondra Žižka

Reputation: 46796

There's the backticks option whatever name, but it's a very bad practice to use non-standard names, and even worse practice to use databases as a kind of record. Think of migrating, various automated tools, gui editors...

Upvotes: 0

martin clayton
martin clayton

Reputation: 78105

You can create databases with purely numeric names - you need to quote though:

CREATE DATABASE `1`;

Limitations on names are in the MySQL documentation.

Upvotes: 4

Related Questions