Use the following command to select database using command line in Mysql.
1 . Grant Permission
GRANT ALL PRIVILEGES ON `database_name`.* TO 'username'@'localhost'WITH GRANT OPTION;
2 . Now Select Database
Use database_name;
you will be switch to this database.