mysql update user code example

Example 1: change mysql password from command line

ALTER USER 'root'@'localhost' IDENTIFIED BY 'New-Password';

Example 2: alter user root mysql

ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPassword';

Example 3: change user mysql

[madegow@fedora20 ~]$ mysql -u root -p
Enter password: 
...
MariaDB [(none)]> select user()
-> ;
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

MariaDB [(none)]> system mysql -u madegow -p
Enter password: 
...
MariaDB [(none)]> select user();
+-------------------+
| user()            |
+-------------------+
| madegow@localhost|

Tags:

Sql Example