Score:0

Why is Access denied for user 'root'@'localhost' (using password: YES)

sa flag

There's litterally hundred of questions revolving around the error I am getting:

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

And none work. Ive ben uninstalling and installing mysql8 for 2 days solid. And have hit dead end after dead end.

I even tried installing 5.7 to save the headache, and hit another dead end.

So Im back to mysql 8.

I can loginto phpmy admin using the root user and password. But not on the putty/console.

Does anyone have any idea what the heck ois wrong with mysql8.

Im using Ubuntu 22.04 and the latest mysql. Which is running by the way.

The only way I can gain access is by adding the: [mysqld]
skip-grant-tables Line, but when I change the password, or create another user, and remove that line. I still get the same error.

I have tried using the default mysqld.cfg as well as a version from an old VPS that works using 5.7. Another dead end.

Im beginning to think this is a purpose built dead end. Ive treied everything.

Andy ideas appreciated.

The bind address is as follows: bind-address = 127.0.0.1 mysqlx-bind-address = 127.0.0.1

Ive tried using 0.0.0.0, my external IP, and none make a difference.

I followed the Digital Ocean install instructions but each time I end up with the same issue. https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-22-04

Thanks.

Heres some of what Ive tried, but frankly, Ive tried many many solutions proposed on here and through google and ended up at the dead end I keep referring to.

I tried using: sudo mysql -u root (thats a standard procedure for me at this point).

Tried: Start with skip-grant-tables and reset the password etc.

These are the two most common solutions.

I recently tried: sql UPDATE mysql.user SET plugin='unix_socket' WHERE user='root'; flush privileges - after starting in safe mode skipping-grant-tables, but ended up with another error that solutions wouldnt work for. Plugin 'unix_socket' is not loaded in Mysql

Also tried: mysql -u root -p -f - no luck there.

Also tried: removing and reinstalling several times, following several tutorials. Digital Ocea, and LinuxBabe,but herss is MariaDB. And I dont want to introduce other possible issues when I move my sites over to thei server? IF I do.

I also did a system upgrade from 18.04 to 22.04 and the same issue prevented me using that system. I have to restore the backup because mysql wouldnt connect after being upgraded from 5.7. Which works stratight awaay, every time I have installed it. over a dozen times.

I am about to test this installation tutorial as it includes a few minor? steps the other tutorials didnt show: https://www.youtube.com/watch?v=SmgiRNoH52s

END NOTE: So although the video above was very different, I managed to get it sorted so I can access mysql in console using password/root user. And I can access phpmyadmin using the same. However if you see my comment at the end of that video. He proceeds to use the ALTER command to change the password back to socket instead of password. WHY is that? I'm backing up now before I try that, but not sure I should ALTER it back to socket at all? Any advice appreciated.Thanks for the push @vidaro as I was ready to jump off a * cliff!

vidarlo avatar
om flag
Does this answer your question? [can't login as mysql user root from normal user account in ubuntu 16.04](https://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04)
sa flag
vidarlo thenks, not sure which part you're referring to. But that just seems to be a whole lot more of what Ive already tried. Plus, they seem to be all talking as if Im logged into mysql> which of course, I get locked out of after I set the password during the setup.
vidarlo avatar
om flag
You've attempted socket authentication, e.g. `sudo mysql -u root`?
sa flag
Yes, then I get the password, which produces the error.
sa flag
Its from the point I use this: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; that phpmyadmin works and console causes the error.
vidarlo avatar
om flag
Can you [edit] your question to include the information given in comments, and explain in some more detail what you've done?
sa flag
I got it working. Please see my END NOTE in edited post above. Please.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.