Document the SSH tunnel features
Connecting to a MySQL instance via an SSH tunnel was added in #634, but there's no mention of it outside of the release notes.
It'd be nice to have examples of how to use this feature. I'd be happy to help write the docs if you can point me in the right direction, but I'll also have to figure out from reading the PR and experimenting how it works.
Thanks! That's very helpful!
It's a bit experimental at this moment, you'll need to install paramiko (pip install paramiko if you've install mycli using pip) and then you should be able to use the -ssh-* arguments (see mycli --help).
The downside are that:
- at this moment two SSH connections are made when connecting using mycli (one for running queries and one for finding the completions).
- paramiko has a load of dependencies which makes mycli less portable.
@meeuw @tsroten I tried ssh tunnel features like this.
mycli -h ssh_db_host -u user -p password --ssh-user dmnlk --ssh-host bastion_server
but, getting this error
'Channel' object has no attribute 'recv_into'
I have already installed paramiko. and i read this comment, but paramiko/paramiko#553 is not merged yet. https://github.com/dbcli/mycli/pull/634#issuecomment-414147486
environment
[]:~/ mycli -V
Version: 1.20.0
[]:~/ python --version
Python 3.7.4
how to solve this problem?
@dmnlk could you please post the version of paramiko you've installed? (pip freeze)
I'm getting the 'Channel' object has no attribute 'recv_into' error too on Ubuntu 18.04.
I tried
mycli -h 172.19.0.1 -u root -p abc --ssh-user ubuntu --ssh-host example.com --ssh-key-filename ~/.ssh/abc.pem
Same issue:
mycli --ssh-host example.com --ssh-user root --ssh-key-filename ~/.ssh/id_rsa -h 0.0.0.0 -u root
'Channel' object has no attribute 'recv_into'
pip freeze
asn1crypto==0.24.0
aws==0.2.5
awscli==1.16.157
backports.csv==1.0.7
bcrypt==3.1.6
boto==2.49.0
botocore==1.12.147
cffi==1.12.3
cli-helpers==1.2.1
Click==7.0
colorama==0.3.9
configobj==5.0.6
cryptography==2.6.1
docutils==0.14
enum34==1.1.6
fabric==2.4.0
futures==3.2.0
invoke==1.2.0
ipaddress==1.0.22
jmespath==0.9.4
mycli==1.20.1
paramiko==2.0.2
powerline-status==2.7
prettytable==0.7.2
prompt-toolkit==2.0.10
pyasn1==0.4.5
pycparser==2.19
Pygments==2.2.0
PyMySQL==0.9.3
PyNaCl==1.3.0
python-dateutil==2.8.0
PyYAML==3.13
rsa==3.4.2
s3transfer==0.2.0
six==1.12.0
sqlparse==0.3.0
tabulate==0.8.5
terminaltables==3.1.0
urllib3==1.24.3
wcwidth==0.1.7
additional notes for the ssh jumpbox documentation..
on ubuntu distros dependencies:
sudo apt install python3-paramiko python3-sshtunnel
tested on ubuntu 24.04