Ubuntu PHP-fpm not connected with mysql
///////////////////////////////////////////////////////////
////////Ubuntu PHP-fpm not connected with mysql////////////
///////////////////////////////////////////////////////////
Run: sudo mysql;
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourPassword';
mysql> FLUSH PRIVILEGES;
///////////////////////////////////////////////////////////
////////Ubuntu PHP-fpm not connected with mysql////////////
///////////////////////////////////////////////////////////
If you are using nginx and unable to connect php with mysql in your php code. Try below commands from your terminal