On the server, I've got it set up, that the root doesn't need to enter password in order to use mysql (credentials are in ~/.mylogin.cnf). Now I want to connect to the mysql remotely via SSH tunnel and I'm expecting that i won't need to enter the password.
# open the tunnel (I'm using local port 3305 because 3306 is already taken for some reason)
ssh server -L 3305:127.0.0.1:3306 -N
# now try to connect
mysql -h 127.0.0.1 -P 3305 -u root
But this doesn't work. Error says: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
What am I doing wrong?