user1145216
user1145216

Reputation: 2494

Does GRANTPRIVILEGES overwrite an existing user and password?

Does the following command:

GRANT ALL PRIVILEGES ON myblog.* TO "wordpress"@"localhost" IDENTIFIED BY "summer";

If executed, set a new password, when there is already an existing user wordpress with password winter?

Upvotes: 1

Views: 767

Answers (2)

DonCallisto
DonCallisto

Reputation: 29922

When the IDENTIFIED BY clause is present and you have global grant privileges, the password becomes the new password for the account, even if the account exists and already has a password. With no IDENTIFIED BY clause, the account password remains unchanged.

From: MySql doc

Upvotes: 0

Sergii Kudriavtsev
Sergii Kudriavtsev

Reputation: 10512

Yes, it does.

When the IDENTIFIED BY clause is present and you have global grant privileges, the password becomes the new password for the account, even if the account exists and already has a password. With no IDENTIFIED BY clause, the account password remains unchanged.

Quoted from MySQL documentation

Upvotes: 3

Related Questions