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:
2). I then go to SSH –> Tunnels, and enter the following information:
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:
Then I go to Tableau and enter the following information:
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:
In my git BASH terminal I type in netstat -an|grep 3306
and get:
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.
Best Answer
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.