sudo -i
mysql or mysql -p -u root
mysql> SELECT user,plugin,host FROM mysql.user WHERE user = 'root';
| user | plugin | host |
| root | auth_socket | localhost |
1 row in set (0.00 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;