Solution:
In case this is NOT your first time setting up the password, attempt this method:
mysql> UPDATE mysql.user SET Password=PASSWORD('your_new_password')
WHERE User='root';
And in case you obtain the pursuing error, there is a high probability that you have never place your password before:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
To place up your password for the first time:
mysql> SET PASSWORD = PASSWORD('your_new_password');
Query OK, 0 rows affected, 1 warning (0.01 sec)
In case you explained mysql employing mysql -u root -p
Try ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
First, log in mysql with sandbox mode
mysql -u <user> -p --connect-expired-password
Thereafter, place password
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('XXXX');
Query OK, 0 rows affected, 1 warning (0.01 sec)