0

I have a python script on my local machine related to a database. I can log in to that database server through a SSH connection. But how can I run my python file on that database server?

Do I need to upload my python script on that server machine? How can I do that?

I logged in to the database server through the ssh connection. I have access to that. I ran my python file which is stored in my local machine on that server. It shows "python3: can't open file .. No such file or directory" I want to run the program and see the output.

  • 1
    I'm confused. Does your program just access data from the database? If so, you don't need to run it on the database server itself; just provide the connection details to the program. If not, you said that you already ran the program on the server. You're going to need to show code and clarify what isn't working. – ndc85430 Nov 20 '22 at 05:52
  • https://stackoverflow.com/questions/21903411/enable-python-to-connect-to-mysql-via-ssh-tunnelling -->Enable Python to Connect to MySQL via SSH Tunnelling – pippo1980 Nov 20 '22 at 16:59
  • Many Thanks. I was finding a way to run the python file without copying to the remote server. I didn't find a way. So, I copied the python file into a folder inside the server and executed the file. Got again an mysql connection error. Later found that there was a credential error. Server hostname should be localhost. – user20551751 Nov 23 '22 at 06:39
  • https://practicaldatascience.co.uk/data-science/how-to-connect-to-mysql-via-an-ssh-tunnel-in-python --> How to connect to MySQL via an SSH tunnel in Python-python – pippo1980 Nov 23 '22 at 20:51

0 Answers0