Choosing a database in mysql with spaces in its name

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

use 'student registration' 

I get a message:

 cannot find database 'student' 
+7
database mysql console spaces
source share
6 answers

You should try using backticks ("` ") to indicate your database name. Generally speaking, it is probably best to use a naming convention to bridge the gap, for example.

 USE `StudentRegistration`; 

or

 USE `student_registration`; 
+18
source share

You have two options.

1 Paste the database name in backtick or single quotation marks.

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

2 Escape over the space character.

USE student\ registration;

Oddly enough, it gives.

ERROR: Unknown command '\'.

But still the database changes.

+9
source share

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

 use `student registration`; 

At least it will be yours.

+1
source share

Use double quotes instead of single, double quotes working for me:

 USE "student registration"; 
+1
source share

To do this, you need to use square brackets:

 Use [student registration] 
-one
source share

Use student registration without quotes.

-one
source share

All Articles