mysqlworkbench Cannot Connect to Database Server code example

Example 1: mysqlworkbench Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306: Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

mysql -u root -p -h 127.0.0.1 -P 3306

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Example 2: your connection attempt failed for user 'root' ubuntu workbench

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';