question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getting remote mysql shell through python

See original GitHub issue

Hi,

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:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
davidjmemmettcommented, Jan 21, 2021

It looks like a satisfactory resolution has been found here, closing the issue.

0reactions
thinksabincommented, Dec 3, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect on remote MySQL database through Python
This is SQL that you'd run on the database in order to ensure that the user ... open console/cmd/terminal and see if you...
Read more >
How To Connect to a Remote MySQL Database with Python
This command will return a path to that file, go there and open it. Now, look for the line which begins with bind-address,...
Read more >
How to Connect to a Remote MySQL Database in Python
In this tutorial, you will learn how to connect to a remote MySQL server in Python. We'll be using the Python MySQL connector...
Read more >
5.1 Connecting to MySQL Using Connector/Python
The connect() constructor creates a connection to the MySQL server and returns a MySQLConnection object. The following example shows how to connect to...
Read more >
How to connect to MySQL via an SSH tunnel in Python
MySQL databases are usually configured to only allow secure connections via SSH. Here's how to create an Python SSH tunnel and connect to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found