0

I have run the following commands found here.

shell> mysql
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'

But when I go to login as root, I can type any string as a password, and it will still let me login.

How can I enforce a password for root, and not allow anonymous users by simply typing mysql

  • Do you have authentication methods other than password enabled for root? – Joe W Oct 7 '18 at 17:25
  • I am not sure. Just installed MySQL on a virtual machine. I'm not sure how to enable authentication methods with this DBMS. – crayden Oct 7 '18 at 19:39
0

The following worked for me:

I ran through the command line wizard to set this up:
shell> mysql_secure_installation

Then entered the following:
shell> mysql
ALTER USER 'root'@'localhost' IDENTIFIED with mysql_native_password;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Credit goes to this question/answer.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.