launching the command line using:
mysql -u localhost
you are leaving the username blank.
the blank username does not have privileges for running the command grant command. hence the returned error
access denied for user ''@'localhost'
you have not logged in, so there is no user.