Reputation:
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'
Upvotes: 19
Views: 51303
Reputation: 1
USE student registration
; - This worked for me like a gem... Also tried other alternatives provided here... But nothing worked for me in MySQL;
Upvotes: 0
Reputation: 1471
Use Double quotes instead of single, double quotes worked for me :
USE "student registration";
Upvotes: 2
Reputation: 109
When I had to deal with other people's tables with spaces the following worked:
use `student registration`;
At least that would be yours.
Upvotes: 2
Reputation: 39
You have to use square brackets to get this work:
Use [student registration]
Upvotes: -1
Reputation: 17142
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.
Upvotes: 13
Reputation: 14225
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`;
Upvotes: 39