mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'
snippet in sql

Illuminate\Database\QueryException : SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'

user8185

$ sudo mysql -u root -p
Now you can add a new MySQL user with the username of your choice.

mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
And finally grant superuser privileges to the user you just created.

mysql> GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

after that go and edit .env DB_USERNAME=newuser
DB_PASSWORD=password

Got error: 1698: Access denied for user 'root'@'localhost' when trying to connect

user9411

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

$ service mysql restart

access denied for user 'root'@'localhost' python sql-connect error

user5132

SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Current-Root-Password';
FLUSH PRIVILEGES;

mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'

user802

ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPassword';