Selecting a database in mysql with spaces in its name

John picture John · Feb 3, 2009 · Viewed 39.6k times · Source

I want to select my particular database in mysql console, but the problem is that my database name has a space in between and mysql ignores the part after the space. For instance, when i give the command:

use 'student registration'

I get the message:

cannot find database 'student'

Answer

David Grant picture David Grant · Feb 3, 2009

You should try using back ticks ("`") to quote your database name. Generally speaking, it's probably better to use a naming convention to eliminate white space, e.g.

USE `StudentRegistration`;

or

USE `student_registration`;