Forums

Establishing MySQL Connection via Tableau Through PuTTY

Hello,

I have a MySQL database that I'd like to connect to Tableau in order to build dashboards out of. I tried following along with this thread, but I couldn't get the results to work for me.

Here's what I'm doing:

On PuTTY:

  • using ssh.pythonanywhere.com as my Hostname in the main PuTTY screen, as seen below:
    Putty Description
  • go to SSH --> Tunnels
  • Enter the following:
  • Port: 3306
  • Destination: myusername.mysql.pythonanywhere-services.com:3306

Then I login with my PythonAnywhere login credentials.

When I go to Tableau, I enter the following information:

Server: 127.0.0.1 Port: 3306

username: my pythonanywhere username password: my database password.

When I do this, I get the following error message:

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

I tried switch the value for Port in the SSH --> Tunnels section to 9990, and when I use that value for the port at Tableau sign in I'm given a different error message:

There was an unknown connection error to the database. The error message below has additional information, but you might need to ask the database administrator to review the database logs. [MySQL][ODBC 8.0(w) Driver]Can't connect to MySQL server on '127.0.0.1' (10061) Unable to connect to the MySQL server "127.0.0.1". Check that the server is running and that you have access privileges to the requested database.

I assume the latter means I'm not even establishing a connection.

I'm not sure what I'm missing. I've double checked my password for the database and it should be correct.

I'd try and post more pictures but for some reason they don't render correctly when I do it :(

Have you replaced myusername in destination hostname with your db username?

@fji, yes I have, but I'll double check to see if I can get it going. Maybe it was a typo.

Try following our help page instructions instead!

3306 port number is correct.

Make sure you are using the db password instead of your pythonanywhere password for the database part! (but ssh password should be pythonanywhere password).

For the db password you can reset it on the DB tab

@conrad -- thanks. I really think everything is correct but I'll double check.

A useful double-check for the MySQL password is to edit the file .my.cnf in your home directory in your private file storage -- it will appear in there.

He intentado de todas las maneras y no ha sido posible conectarme a ningún software de análisis de datos, ¿existe alguna manera diferente que ssh? Esto es muy frustrante.

@Analysi -- could you tell us more how did you try to do that and what errors did you get?

Mira:

  1. Uso PUTTY para conectarme y así tener acceso desde el localhost, como lo dice el articulo de ayuda https://help.pythonanywhere.com/pages/AccessingMySQLFromOutsidePythonAnywhere/

En "Session" > Host Name(or IP address)" = ssh.pythonanywhere.com En "Connection -> SSH -> Tunnels > Source port"=3306 En "Connection -> SSH -> Tunnels > Destination"= Analysi.mysql.pythonanywhere-services.com:3306

Luego ingreso usuario y contraseña y hasta ahí perfecto.

Pero cuando intento conectar a una de mis bases por MySQL a 127.0.0.1 no es posible, por ejemplo intento conectarme por Excel, a una base de datos MySQL con servidor 127.0.0.1 y el nombre de mi tabla y no funciona. Me dice: "MySQL: Unable to connect to any of the specified MySQL hosts."

Espero me puedan ayudar, muchas gracias

Mira:

  1. Uso PUTTY para conectarme y así tener acceso desde el localhost, como lo dice el articulo de ayuda https://help.pythonanywhere.com/pages/AccessingMySQLFromOutsidePythonAnywhere/

En "Session" > Host Name(or IP address)" = ssh.pythonanywhere.com En "Connection -> SSH -> Tunnels > Source port"=3306 En "Connection -> SSH -> Tunnels > Destination"= Analysi.mysql.pythonanywhere-services.com:3306

Luego ingreso usuario y contraseña y hasta ahí perfecto.

Pero cuando intento conectar a una de mis bases por MySQL a 127.0.0.1 no es posible, por ejemplo intento conectarme por Excel, a una base de datos MySQL con servidor 127.0.0.1 y el nombre de mi tabla y no funciona. Me dice: "MySQL: Unable to connect to any of the specified MySQL hosts."

Espero me puedan ayudar, muchas gracias

Are you leaving the PuTTY window open after it has connected? It will just show a Bash shell, and you don't need to type anything into it, but it does need to remain open in order to keep the SSH tunnel running.

Si, dejo la venta PUTTY abierta y corriendo.

He intentado incluso conectarme desde la consola, usando "mysql -h 127.0.0.1 -u Analysi -p", pero no es posible, si se conecta si lo hago con "mysql -h Analysi.mysql.pythonanywhere-services.com -u Analysi -p"

From the Bash console in PuTTY, can you use

mysql -h Analysi.mysql.pythonanywhere-services.com -u Analysi -p

to connect to your database?