Search code examples
mysqlddluser-management

mysql grant privileges without identified by password


When I run:

mysql> grant all privileges on database.* to user@localhost;

It returns:

Query OK, 0 rows affected (0.00 sec)

Shouldn't it give an error as I'm not including "identified by 'password'" ?

Please clarify, the user already has a password.


Solution

  • To quote the documentation:

    Without IDENTIFIED BY, the account password remains unchanged.

    Since the account already exists, and has a password, and you don't want to change it, you should indeed not specify an identified by clause.