3

I just installed MySQL server on my Ubuntu machine. All installed ok, when it asked for my password, I simply hit 'enter' so as to leave the password blank. Now when I try to login:

mysql -u root -p

and simply hit enter, I get the following error:

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I don't understand what the error is or how to fix it. Please can someone help? I've tried to read the MYSQL Docs but I don't understand what they're saying.

I also get an "Access Denied" page when I try to access phpMyAdmin

Francisco
  • 10,918
  • 6
  • 34
  • 45
danjswade
  • 557
  • 2
  • 8
  • 16
  • See at [here](https://askubuntu.com/a/777008) – tnductam Mar 07 '19 at 16:34
  • maybe this is helpofull for you https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost/64238417#64238417 – Kashif Oct 07 '20 at 06:32

2 Answers2

7

Had the same issue. Executing with Super user privileges worked for me.

sudo mysql -u root -p
piyumi_rameshka
  • 320
  • 4
  • 9
0

Have you tried to ommit -p for password free login?

mysql -u root
Maggistro
  • 76
  • 4
  • Yeah, I get the same response back, so assuming there is something more fundamentally wrong than a password issue – danjswade Mar 11 '17 at 15:36
  • Well you could reset the password, but thats a tedious process. Would advice to reinstall and actually SET a password, even if its just 123. – Maggistro Mar 11 '17 at 15:43
  • I tried uninstalling it by doing sudo apt-get purge mysql-server and reinstalled it, but when I reinstalled it, it didn't ask me to put in the password – danjswade Mar 11 '17 at 15:47
  • try these steps for a clean deinstall: http://stackoverflow.com/questions/10861374/how-to-remove-mysql-completely-with-config-and-library-files – Maggistro Mar 11 '17 at 16:04
  • Just tried those, reinstalled and still the same thing. Didn't as me to re-enter y password – danjswade Mar 11 '17 at 16:22