Error: MySQL said: Access denied for user ‘root’@’localhost’ in MySQL 5.7
If you are trying to install new MySQL instance and want to connect to this instance through SSH tunnel with GUI software like Sequel Pro or MySQL Workbench then you can’t help meeting with the error: MySQL said: Access denied for user ‘root’@’localhost’ . Especially if you are installing a Percona MySQL Server.
It occurs because MySQL resolves address localhost as 127.0.0.1 and by default in mysql.user table exits a record for localhost users only. But in case if you create a new user for 127.0.0.1 and try to connect through SSH you can get the same error. You can solve these errors with simple action, just put this single line in your my.cnf in [mysqld] section:
[mysqld] skip-name-resolve = 1