1

I have a database that runs on pythonanywhere.com, and am trying to connect Tableau to it, and need to set up an SSH Tunnel in order to do so.

The directions on pythonanywhere's website mention PuTTY, and many people on Tableau forums also use it, so this is what I'm going with. I've been trying for about 2 weeks to get this working, but no luck.

So here's what happens:

1). I enter ssh.pythonanywhere.com as the host connection on the main page: enter image description here

2). I then go to SSH --> Tunnels, and enter the following information: enter image description here

The information in the Destination field has the form my-username.mysql.pythonanywhere-services.com:3306

Then I hit Open, and am prompted for my sign in credentials to Python Anywhere:

enter image description here

Then I go to Tableau and enter the following information:

enter image description here

In the password field I type in my database password.

The message that always comes up is:

[MySQL][ODBC 8.0(w) Driver]Access denied for user 'myusername'@'localhost' (using password: YES)
Invalid username or password.

Now obviously, there's a natural response to this: double check my password.

For now just take my word for it that I've double checked this several times and it is correct.

I've tried to find help on PythonAnywhere's forums, and Tableau's forums, but no solutions have been found.

Also:

I've tried switching out the port 127.0.0.1 with localhost, but this did not work.

I have connected to my database externally in a Jupyter Notebook using this same information, so I have some confirmation that this info has been used successfully.

I've tried connecting to MySQL Workbench using the same info and I get the same error message, which makes me think there's something about my database configuration which is not working, but I have no idea where to look.

UPDATE:

In my PuTTY Bash terminal the command telnet 127.0.0.1 3306 returns the message:

Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

In my DOS terminal I get the following:

enter image description here

In my git BASH terminal I type in netstat -an|grep 3306 and get:

enter image description here

UPDATE 2:

I was on codementor trying to get this resolved, and we had the following issue:

after signing in throuhg PuTTY, I entered the following command:

mysql -h 127.0.0.1 -u jonathanbechtel -p

Which returned the following error message:

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

We also tried switching out 127.0.0.1 with localhost and got a different error message:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

To be honest I don't understand the significance of this, but was told by him that this is unusual and might signal some security settings on my account with PythonAnywhere. I started this forum message on their forums to try and troubleshoot it.

  • Is access for 'myusername'@'localhost' allowed though in your database? A connection via the SSH tunnel will be seen on the database server as a local one. – mustaccio Nov 6 '19 at 18:22
  • What @mustaccio said. If you can access via other means, then you need to check the authentication setup – Philᵀᴹ Nov 6 '19 at 18:23
  • @mustaccio - do you mean with the database on pythonanywhere? I assume the answer is yes, since they list instructions on how to connect through PuTTy. – Jonathan Bechtel Nov 6 '19 at 18:54
  • You shouldn't assume anything, if you intend to solve the problem instead of waiting for it to solve itself. Since you have other means to connect to the database, you can do so and check. – mustaccio Nov 6 '19 at 18:56
  • @mustaccio okay, I will double check, but I believe the answer is yes. – Jonathan Bechtel Nov 6 '19 at 19:02
0

If you are connecting on "localhost", then GRANT ... TO user@localhost ... applies. "127.0.0.1" may be a synonym for "localhost".

If you are connecting via TCP/IP, then GRANT ... TO user@'11.22.33.44' ... applies. (Replace with suitable IP or hostname or wildcard.)

It is OK to have both GRANTs in order to allow access either way.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.