Jump to: navigation, search

Mysql SET PASSWORD

From w3cyberlearnings

Contents

MySQL SET PASSWORD Function

This function resets a new password.

Syntax SET PASSWORD

  • user is a user name
  • host is the user host name
  • new password is the new password
SET PASSWORD FOR user@host = PASSWORD('new password');

Example 1

mysql> SET PASSWORD FOR 'bob'@'w3cyberlearnings.com' = PASSWORD('123secret');
Query OK, 0 rows affected (0.33 sec)

Example 2:Use Update to reset password

mysql> UPDATE mysql.user SET password=PASSWORD('123secret')
    ->  WHERE user='bob' AND HOST='w3cyberlearnings.com';
Query OK, 0 rows affected (0.37 sec)
Rows matched: 1  Changed: 0  Warnings: 0


Related Links


---CREATE USER--- DROP USER--- GRANT User Privilege--- RENAME USER--- REVOKE--- SET PASSWORD---


Navigation
Web
SQL
MISC
References