The answer may sound silly, but after wasting hours of time, this is how I got it to work
mysql -u root -p
I got the error message
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Even though I was typing the correct password(the temporary password you get when you first install mysql)
I got it right when I typed in the password when the password prompt was blinking