laravel 8 SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (S code example

Example 1: ERROR 1698 (28000): Access denied for user 'root'@'localhost'

>>> sudo mysql -u root -p

>>> USE mysql;

>>> UPDATE user SET plugin='mysql_native_password' WHERE User ='root';

>>> FLUSH PRIVILEGES;

>>> exit;

>>> service mysql restart;

Example 2: windows error 1045 (28000): access denied for user 'root'@'localhost' (using password: yes)

update user set authentication_string=password('my_password') where user='root';