getting remote mysql shell through python
See original GitHub issueHi,
Sorry this might not be the proper place to ask for a suggestion but I’m kinda lost going through the fabric2 connection documents. I’m trying to get a remote machine’s bash shell with python script and also the mysql shell of the remote machine.
Getting the remote bash shell was straight forward with new api using Connection and ‘run’ method.
def connect_bash(): connect = Connection(host='192.168.0.16', user='hello', port=22, connect_kwargs={'password':'heylo'}) myshell = connect.run("/bin/bash", pty=True)
But I’m struggling to get the mysql shell from the remote machine. Currently I tried using local_forward but it only run the db command and won’t give me the mysql shell.
Is there a way I can achieve that using the fabric2 ?
Thank you.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
It looks like a satisfactory resolution has been found here, closing the issue.
hi,
I found out directly calling the mysql binary will do.
def connect_sql_shell(): connect = Connection(host='192.168.0.16', user='sabin', port=22, connect_kwargs={'password': 'sabin'}) myshell = connect.run("/usr/bin/mysql -u sabin -p", pty=True)
this actually gave me what i wanted so far.
Thanks.