MariaDB/SQL/ALTER: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{fmt/title|"ALTER" SQL statement}}
{{fmt/title|SQL command: <code>ALTER</code>}}
==Related==
==Related==
* This modifies users created by {{l/same|CREATE}}.
* This modifies [[../user/]]s created by {{l/same|CREATE}}.
==Reference==
* [https://mariadb.com/kb/en/alter-user/ MariaDB Knowledge Base]
==Syntax==
==Syntax==
'''Note''': The table below is incomplete.
<code>ALTER USER</code> [<code>IF EXISTS</code>]
<code>ALTER USER</code> [<code>IF EXISTS</code>]
: {{fmt/arg|user spec}} [, ''repeat...'']
: {{fmt/arg|user spec}} [, ''repeat...'']
Line 12: Line 16:
! argument name || value(s)
! argument name || value(s)
|-
|-
| valign=top | '''{{fmt/arg|user spec}}''' || {{fmt/arg|username}} {{fmt/arg/opt|authentication option}}
| valign=top | '''{{fmt/arg|user spec}}''' || {{fmt/arg|username}} {{fmt/arg/opt|auth option}}
|-
|-
| valign=top | '''{{fmt/arg|TLS option}}''' || ''one of &ndash;''
| valign=top | '''{{fmt/arg|auth option}}'''<br>(authentication option) || ''one of &ndash;''
* <code>IDENTIFIED BY</code> '{{fmt/arg|password}}'
* <code>IDENTIFIED BY '</code>{{fmt/arg|password}}<code>'</code>
* <code>IDENTIFIED BY PASSWORD</code> '{{fmt/arg|password hash}}'
* <code>IDENTIFIED BY PASSWORD '</code>{{fmt/arg|password hash}}<code>'</code>
* <code>IDENTIFIED</code> {<code>VIA</code>|<code>WITH</code>} {{fmt/arg|authentication rule}} [<code>OR</code> ''repeat...'']
* <code>IDENTIFIED</code> {<code>VIA</code>|<code>WITH</code>} {{fmt/arg|authentication rule}} [<code>OR</code> ''repeat...'']
|-
|-
Line 45: Line 49:
* {{fmt/arg|authentication plugin}} {<code>USING</code>|<code>AS</code>} <code>PASSWORD('</code>{{fmt/arg|password}}<code>')</code>
* {{fmt/arg|authentication plugin}} {<code>USING</code>|<code>AS</code>} <code>PASSWORD('</code>{{fmt/arg|password}}<code>')</code>
|}
|}
==Example==
* <syntaxhighlight inline lang=SQL>ALTER USER 'rc-bot'@localhost IDENTIFIED BY 'YourPassword!';</syntaxhighlight>

Latest revision as of 00:41, 26 April 2026

SQL command: ALTER

{{#set: page title=SQL command: ALTER }}

  • This modifies [[../user/]]s created by [[../CREATE|CREATE]].

Reference

Syntax

Note: The table below is incomplete.

ALTER USER [IF EXISTS]

<user spec> [, repeat...]
[REQUIRE {NONE | <TLS option> [[AND] repeat...]}]
[WITH <resource option> [repeat...]]
[ <lock option> ] [ <password option> ]
argument name value(s)
<user spec> <username> [ <auth option> ]
<auth option>
(authentication option)
one of –
  • IDENTIFIED BY '<password>'
  • IDENTIFIED BY PASSWORD '<password hash>'
  • IDENTIFIED {VIA|WITH} <authentication rule> [OR repeat...]
<resource option> one of –
  • MAX_QUERIES_PER_HOUR <count>
  • MAX_UPDATES_PER_HOUR <count>
  • MAX_CONNECTIONS_PER_HOUR <count>
  • MAX_USER_CONNECTIONS <count>
  • MAX_STATEMENT_TIME <time>
<lock option> one of –
  • ACCOUNT LOCK
  • ACCOUNT UNLOCK
<password option> one of –
  • PASSWORD EXPIRE
  • PASSWORD EXPIRE DEFAULT
  • PASSWORD EXPIRE NEVER
  • PASSWORD EXPIRE INTERVAL N DAY
<authentication rule> one of –
  • <authentication plugin>
  • <authentication plugin> {USING|AS} '<authentication string>'
  • <authentication plugin> {USING|AS} PASSWORD('<password>')
<authentication plugin> one of –
  • <authentication plugin> {USING|AS} '<authentication string>'
  • <authentication plugin> {USING|AS} PASSWORD('<password>')

Example

  • ALTER USER 'rc-bot'@localhost IDENTIFIED BY 'YourPassword!';