4

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.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Nabeel Khan
  • 3,715
  • 2
  • 24
  • 37

2 Answers2

5

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.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
0

5.5 or newer versions of MySQL you should confirm that a command like grant all privileges on database.* to user@'10.1.1.12; actual does what you want. I'm seeing it create a user without a password, that is you can login with an empty password.

Brian C.
  • 6,455
  • 3
  • 32
  • 42