1

Well, actually it is mariadb, but to start its client, I need to enter "mysql" in command line.

Anyway, after entering

mysql  --user=root

Note, that at this time "root" doesn't have a password, so I successfully login and then:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('my_pass');

And it works, from now on I have to use "my_pass" to login.

But then I do:

sudo service mysql restart

And from now on, root's password is again reseted to "no password at all".

And again, to login I can't give any password.

Googling this doesn't help, because most articles are about "how to reset user password" :)

6
  • 1
    Did you run this query via the root user? Commented Feb 24, 2016 at 12:40
  • Yes, first I login as root to mysql(mariadb), then I restart the mysql/mariadb service as sudo. Is there another way? Commented Feb 24, 2016 at 12:46
  • @PhiterFernandes I forgot to call you. Commented Feb 24, 2016 at 12:53
  • @PhiterFernandes somebody suggested to do flush privileges and now I have error: "Incorrect information in file: './mysql/tables_priv.frm' " Commented Feb 24, 2016 at 12:57
  • 1
    Yeah the flush privileges would actually set the password and make it fixed. Forgot about that. Commented Feb 24, 2016 at 13:15

2 Answers 2

1

Well, I managed to solve my problem - if anybody's interested you have to do:

flush privileges

After changing passwords.

Sign up to request clarification or add additional context in comments.

Comments

0

I am using MacBook M2, I just uninstalled the MySQL server and then it works fine.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.