0

I'm following a text tutorial, where I create a user:

 create user 'APP'@'localhost' identified by 'APP';
 grant all privileges on *.* to 'APP'@'localhost';
 quit

When I try to login to the user with:

mysql -u APP -p

I'm asked a password. Entering the password give me the error:

ERROR 1045 (28000): Access denied for user 'APP'@'localhost' (using password: YES)

Which password does the created user have?

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • It's "APP", as specified? – Progman Jun 09 '22 at 17:16
  • @Progman Sadly that doesn't work. – Striggy Burger Jun 09 '22 at 17:18
  • 2
    "identified by 'APP';" This literally says APP is your password. Else you executed another user – Timberman Jun 09 '22 at 17:19
  • 1
    _Entering the password give me the error:_ Entering WHAT as the password – RiggsFolly Jun 09 '22 at 17:22
  • 2
    @StriggyBurger Does it also not work when you run `FLUSH PRIVILEGES` or restart the MySQL server (even though it shouldn't be necessary)? – Progman Jun 09 '22 at 17:22
  • 1
    please dont put SOLVED stuff in the question. Thats why there is an answer space, once its accepted then that indicates a solution – RiggsFolly Jun 09 '22 at 17:28
  • Usually you don't need `FLUSH PRIVILEGES` when adding a user. It looks like you did something else before (or after), which is not present in your question to reproduce this issue. – Progman Jun 09 '22 at 17:30
  • actually ``FLUSH PRIVILEGES;`` is necessary, otherwise the changes are not saved and it is as if you have not created anything. Maybe that was in versions older than [MYSQL 5.0](https://stackoverflow.com/questions/36463966/mysql-when-is-flush-privileges-in-mysql-really-needed). @Progman – Javier G.Raya Jun 09 '22 at 17:32
  • in my case it was compulsory because it was not applied and I solved it with flush. – Javier G.Raya Jun 09 '22 at 17:36

1 Answers1

1

The identified by portion is where you are setting a password for a user. So 'APP' is the password.

Edit: You may also need to execute FLUSH PRIVILEGES; for the change to take affect.