Difference between revisions of "Update mysql user password"

From DevOps Notebook
(Created page with "<pre> mysql> ALTER USER 'user-name'@'some_host_ip' IDENTIFIED BY 'NEW_USER_PASSWORD'; mysql> FLUSH PRIVILEGES; </pre> For earlier versions of mysql (mysql 5.7.6 or MariaDB 10...")
 
 
Line 1: Line 1:
<pre>
+
<syntaxhighlight lang="mysql">
 
mysql> ALTER USER 'user-name'@'some_host_ip' IDENTIFIED BY 'NEW_USER_PASSWORD';
 
mysql> ALTER USER 'user-name'@'some_host_ip' IDENTIFIED BY 'NEW_USER_PASSWORD';
 
mysql> FLUSH PRIVILEGES;
 
mysql> FLUSH PRIVILEGES;
</pre>
+
</syntaxhighlight>
  
 
For earlier versions of mysql (mysql 5.7.6 or MariaDB 10.1.20 and earlier):
 
For earlier versions of mysql (mysql 5.7.6 or MariaDB 10.1.20 and earlier):
<pre>
+
<syntaxhighlight lang="sql">
 
mysql> SET PASSWORD FOR 'user-name'@'localhost' = PASSWORD('NEW_USER_PASSWORD');
 
mysql> SET PASSWORD FOR 'user-name'@'localhost' = PASSWORD('NEW_USER_PASSWORD');
 
mysql> FLUSH PRIVILEGES;
 
mysql> FLUSH PRIVILEGES;
</pre>
+
</syntaxhighlight>

Latest revision as of 10:07, 2 August 2022

mysql> ALTER USER 'user-name'@'some_host_ip' IDENTIFIED BY 'NEW_USER_PASSWORD';
mysql> FLUSH PRIVILEGES;

For earlier versions of mysql (mysql 5.7.6 or MariaDB 10.1.20 and earlier):

mysql> SET PASSWORD FOR 'user-name'@'localhost' = PASSWORD('NEW_USER_PASSWORD');
mysql> FLUSH PRIVILEGES;