I got the same error message (Can’t select database) and found this old thread.
The database has to be created. OK.
Then the user has to be created. OK.
The user needs the privileges to select the database and to create tables.
Wrong:
grant usage on *.* to user_XXX@localhost identified by ‘XXXXXXXX’;
Correct:
GRANT ALL PRIVILEGES ON wordpress_db_XXXX.* TO ‘user_XXX’@’localhost’ identified by ‘XXXXX’;