Selecting a database in mysql with spaces in its name Selecting a database in mysql with spaces in its name mysql mysql

Selecting a database in mysql with spaces in its name


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`;


You have two options.

1 Enclose the database name in backticks or single quotes.

USE `student registration`;USE 'student registration';

2 Escape the white space character.

USE student\ registration;

Oddly enough this produces.

ERROR: Unknown command '\ '.

But still changes the database.


When I had to deal with other people's tables with spaces the following worked:

use `student registration`;

At least that would be yours.