mysqldatabasenaming-conventionsfully-qualified-naming

Can MySQL database name be numeric?


MySQL wont let me create a database name that only has numbers. It only works when I add letters.

How do I create a database name in MySQL that only uses numbers?

CREATE DATABASE 2752054;


Solution

  • It should be possible, if quoted. See 9.2 Schema Object Names - there is no relevant special clause added to identifiers used for database (as opposed to table) names for this case.

    Identifiers may begin with a digit but unless quoted may not consist solely of digits.

    CREATE DATABASE `2752054`;
    

    However, I'd encourage use of at least a meaningful prefix..