sudo mysql --user=root mysql
//Once logged in, you will see the mysql> prompt.
UPDATE mysql.user SET authentication_string=null WHERE User='root';
flush privileges;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password_here';
flush privileges;
exit
-- DEFAULT: Username:root , Password: – (none)
mysql> SET PASSWORD FOR root@localhost=PASSWORD('mypassword');
mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost
IDENTIFIED BY 'mypassword' WITH GRANT OPTION;