Score:0

Can't login mysql db access denied for user 'root'

bn flag

after installing mysql-server using sudo apt install mysql-server and login by typing mysql ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'very_strong_password';. After that I quit. And now when I'am trying to login mysql by typing mysql it tell me ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) I already tried

sudo mysqld_safe --skip-grant-tables &

like commands and nothing changed. It's on my local computer and I'am using Ubuntu 20.04 I also tried to remove mysql and It also doesn't change anything How can I login my mysql server.

in flag
Recent "best practice" for MySQL Server since 2017 has been to **not** use the `root` account unless setting the server up the first time or fixing something that has gone really, really wrong. You will likely need to remove MySQL, then remove the remaining files in `/var/lib/mysql` before you can have a system that works. **Note** that nothing should use the `root` account. Ever. Create a separate admin account with a good password. `root` is only for setup and fixing really big problems ...
hr flag
If you set a password and want to use it, you must invoke the `mysql` command with the `-p` or `--password` option ex. `mysql -u root -p`
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.