Caleb
Caleb

Reputation: 57

Can't connect to mysql via CLI, but phpmyadmin works just fine

I'm at my wits end trying to solve this issue. I can log into the root account (or any other account for that matter) just fine in PHPmyadmin. Howerver whenever I try to log in via the command line, I get the following error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I've even tried creating a new user, making sure to specify its host as "localhost" and not "127.0.0.1" or "%" and it still doesn't work.

I don't even know where to begin at this point, as I've exhausted all the options from googling "Access denied for user 'root'@'localhost'".

Making a new user in phpmyadmin: adding a new user in phpmyadmin

Trying to log in with it on CLI: trying to log in with new user

Yet (and this is not something easily shown in a screenshot) I can log into phpmyadmin using that same username & password.

This is a production server that I inherited and it's been running just dandy for at least 4 years now, so I really can't tell you much about how it was setup. Also, some of the recommendations of uninstall/reinstall, stop, etc are simply not possible at this time.

My questions (I've seen other 'questions' closed for not stating this clearly):

  1. HELP! Why isn't this working? What am I doing wrong?
  2. I have a 500mb db that I need to import for a new project and even with some settings tweaks phpmyadmin is barfing all over it, so cli was the only other option I could think of. Is there some other possibility that I'm overlooking?

Some additional details:

Upvotes: 0

Views: 845

Answers (1)

Redbeard011010
Redbeard011010

Reputation: 964

Specify the port by adding -P3307 to your login string.

Upvotes: 2

Related Questions