My Mysql version is Server version: 5.6.19-0ubuntu0.14.04.1 (Ubuntu) I have two databases, with a test table in each database. I can run the following select statement in one db, but not the other.

This works:

mysql> select * from 1ce62e96db1c4f6cb45535830366beb5.test;
Empty set (0.29 sec)

However, the other doesn't work:

mysql> select * from 344e2a0e00ca4fdf9998001885081798.test;
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 '344e2a0e00ca4fdf9998001885081798.test' at line 1
mysql> select * from `344e2a0e00ca4fdf9998001885081798`.test;
Empty set (0.31 sec)

So, it seems Mysql likes the database name 1ce62e96db1c4f6cb45535830366beb5, but it doesn't like 344e2a0e00ca4fdf9998001885081798.

  • 1
    Use backquotes `344e2a0e00ca4fdf9998001885081798` – ypercubeᵀᴹ Jun 5 '15 at 12:44
  • 1
    See a similar issue: dba.stackexchange.com/questions/56893/… – ypercubeᵀᴹ Jun 5 '15 at 12:49
  • 2
    I think the 344e2a0e00ca4fdf9998001885081798 is converted to the number 344e2 (i.e. 344 * 10^2 = 34400) – ypercubeᵀᴹ Jun 5 '15 at 12:50
  • 1
    I have no idea/explanation why the other db name isn't converted to 1 though. So my above comments may not explain well the reason of this failure. – ypercubeᵀᴹ Jun 6 '15 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.