php - How to fix Connection failed: Access denied for user 'webroot'@'localhost' (using password: YES)

I have tried to connect to local mysql by php5.6 on Ubuntu 20. First time I have tried to use root user, but it not worked. So I am using other user. I am sure that password, host, and user name is true. When I installed mysql, I ran mysql_secure_installation.

$servername = "localhost";
$username = "webroot";
$password = "xxxxxxx";
// Create connection
$conn = mysqli_connect($servername, $username, $password);

mysql.user table is like this:

+

I should work. Even root@localhost user. How could I fix this?

Answer

--------+

Answer

Answer

---+

Answer

-+ | user | plugin | host | +

Answer

--------+

Answer

Answer

---+

Answer

-+ | root | mysql_native_password | % | | debian-sys-maint | caching_sha2_password | localhost | | mysql.infoschema | caching_sha2_password | localhost | | mysql.session | caching_sha2_password | localhost | | mysql.sys | caching_sha2_password | localhost | | root | mysql_native_password | localhost | | webroot | mysql_native_password | localhost | +

Answer

--------+

Answer

Answer

---+

Answer

-+

Source