Fedora release 20 (Heisenbug) 3.19.3-100.fc20.x86_64
Packages:
- mysql-workbench-community.x86_64 6.1.7-1.fc20
- mariadb.x86_64 1:5.5.41-1.fc20
- mariadb-libs.x86_64 1:5.5.41-1.fc20
- mariadb-server.x86_64 1:5.5.41-1.fc20
I can connect to a running, remote MySQL database server just fine using the command line. I need to
- remotely login on a remote machine using SSH, and from there
- perform the MySQL login command.
(Meaning the database server is not on my local network and I can not connect to it from my local machine).
[user@my-local-machine ~]$ ssh [user]@[remote-host] -p [port]
[user@remote-host ~]$ mysql -u [db-user] -h 192.168.x.x -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g. Your
MariaDB connection id is [id] Server version: 5.5.40-MariaDB MariaDB
ServerCopyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.MariaDB [(none)]>
However, if I try to use MySQL Workbench, I get the following error:
Failed to Connect to MySQL at 192.168.x.x:3306 through SSH tunnel at [host]:[port] with user [db-user]
Lost connection to MySQL server at 'reading initial communication packet', system error: 0
Best Answer
I helped him find a workaround in chat:
Evidently his MySQL Workbench app is not able to properly set up the SSH forwarding tunnel, so I had him set it up manually using the OpenSSH
ssh
client as follows:ssh -L 33000:192.168.x.x:3306 user@host
Then, once that is running, he was able to do a direct connect in MySQL Workbench to
localhost:33000
and it worked.