mysql numeric database limitation
-
22-09-2019 - |
Question
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?
Solution
You can create databases with purely numeric names - you need to quote though:
CREATE DATABASE `1`;
Limitations on names are in the MySQL documentation.
OTHER TIPS
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...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow