ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'
No, you should run mysql -u root -p
in bash, not at the MySQL command-line.
If you are in mysql, you can exit by typing exit.
You may need to set up a root account for your MySQL database:
In the terminal type:
mysqladmin -u root password 'root password goes here'
And then to invoke the MySQL client:
mysql -h localhost -u root -p