0

I want to run MySQL commands from terminal. But getting the following error.

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

On 1st time I change my root@localhost password and created another user hello@ localhost with all privileges. But after that couldn't login again. I used mysql -h during 1st setup.

These commands are causing the above error.

sudo mysql -u root;
sudo mysql -u hello;
sudo mysql -h localhost mysql;
sudo mysql -h localhost hello;

Note that I know my current passwords and want to change them.

2
  • why do you put a ; behind these commands? Please do not do that. Also: drop the sudo; not needed for a normal connecting to mysql.And "using password: NO" claims you did not use a password. "I want to run MySQL commands from terminal" you do that with the "-e" option. – Rinzwind Feb 13 at 18:05
  • I do it because I'm use to it. I have a password, because in PHP if I don't enter a password, script doesn't work. – Arghadip Feb 13 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.