S
S
Sergey Burduzha2021-06-06 20:53:08
linux
Sergey Burduzha, 2021-06-06 20:53:08

Why doesn't mysql password work in terminal?

Good afternoon.
Installed mysql using the following instructions.

sudo apt install mysql-server
sudo mysql_secure_installation


And set the root password.

Interestingly, in the terminal I could enter mysql without a password, but I could not enter the workbench.
To do this, set the root password.

Add password for the root to work with workbench
sudo mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Serii1981;';


And now with the help of this password I can connect to the workbench.
But now I can't access mysql in the terminal.

[email protected] ~/Documents/-Knowledge-base $ sudo mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


What is going on?
Help me figure it out.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hanneman, 2021-06-06
@serii81

sudo mysql -u root -p

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question