Объекты
-
ith no
FOR
clause, this statement sets the password for the current user:user
SET PASSWORD =
password_option
;Any client who connects to the server using a nonanonymous account can change the password for that account. To see which account the server authenticated you as, invoke the
CURRENT_USER()
function:SELECT CURRENT_USER();
Permitted
old_passwords
values are described later in this section. -
With a
FOR
clause, this statement sets the password for the named account, which must exist:user
SET PASSWORD FOR 'jeffrey'@'localhost' =
password_option
;In this case, you must have the
UPDATE
privilege for themysql
database.
When the read_only
system variable is enabled, SET PASSWORD
requires the SUPER
privilege in addition to any other required privileges.
If a FOR
clause is given, the account name uses the format described in Section 6.2.3, “Specifying Account Names”. The user
user
value should be given as '
, where user_name
'@'host_name
''
and user_name
''
are exactly as listed in the host_name
'User
and Host
columns of the account's mysql.user
table row. If you specify only a user name, a host name of '%'
is used. For example, to set the password for an account with User
and Host
column values of 'bob'
and '%.example.org'
, write the statement like this:
SET PASSWORD FOR 'bob'@'%.example.org' = PASSWORD('cleartext password
');