yes, a database needs to be created first.
you need to use valid values,
your command:
GRANT SELECT ON databasename TO 'databaseusername'@'localhost' IDENTIFIED BY 'userdatabasepassword';
would only work if you had a database that was named "databasename", and there was a user created in MySQL named "databaseusername" with the password set to "userdatabasepassword" I highly doubt this is the case.
you need to use a valid database name, a valid user name and the password associated with that user.