mysql edit user code example

Example 1: alter user mysql native password

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<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