Connecting to mysqld using Workbench and SSH tunnel
I'm trying to connect to the database on my linode - I've set up SSH to use authentication keys, and I'm trying to set up an SSH tunnel within MySQL Workbench. The trouble is that I just can't connect to the MySQL service.
I'm using Ubuntu 14.04 LTS. In workbench I've entered the IP address of my linode, my SSH username, I've pointed it to my private key file, the MySQL hostname is set to 127.0.0.1 and the port is 3306. The username is root, and the password is the root password.
No matter what I do I just can't connect. When I click 'test connection', I get a message box saying "Successfully made the MySQL connection". But when I actually try and open the connection, I get a message saying: "Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:". If I just SSH to the server though, and run MySQL, there's no problem logging in.
Is there something I'm missing or could it be a bug in Workbench? This is the output from the workbench log:
21:35:46 [INF][ SSH tunnel]: Existing SSH tunnel found, connecting
21:35:47 [INF][ SqlEditor]: Opened connection 'Linode Schemas' to (Ubuntu) version 5.5.43-0ubuntu0.14.04.1
21:35:47 [INF][ AutoCCache]: Initializing autocompletion cache for Linode_Schemas
21:35:49 [ERR][ SqlEditor]: SQL editor could not be connected: Lost connection to MySQL server during query
21:35:49 [ERR][ SqlEditor]: Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:
Lost connection to MySQL server during query
Please:
1 Check that mysql is running on server 127.0.0.1
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from
21:35:49 [INF][ SSH tunnel]: Existing SSH tunnel found, connecting
Also this is the output of````
netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
````
Thanks a lot for you help.