PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, January 31, 2022

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

 January 31, 2022     mysql, mysql-error-1045, phpmyadmin     No comments   

Issue

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:

  • This is on Windows server 2012 R2 SP1
  • Mysql version 5.1.66
  • Non-default port of 3307, I think.

Solution

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



Answered By - Redbeard011010
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing