Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vsorensen
Frequent Visitor

Connect to MySQL Database with Hostname via SSH Tunnel

Hi everyone,

 

I am facing the following issue: I would like to connect to a mysql database with a hostname using an SSH tunnel. The SSH tunnel is already configured using Putty. I have the server name, host name and port, database name, username, and password. Where do I enter information for the hostname and port number?

 

I've gone round and round in circles with this so any help would be appreciated!

1 ACCEPTED SOLUTION

The problem was with the database, there were additional firewalls that I could not get passed, even with the SSH tunnel. 

 

To test the database connection over an SSH tunnel, follow these instructions (in local Windows):

  1. Open Command Prompt
  2. Enter the following prompts:
powershell
Test-NetConnection hostname -port xxxx

 

If the connection fails, Power BI will not be able to connect to the database. 

View solution in original post

5 REPLIES 5
VahidDM
Super User
Super User

Hi @vsorensen 

 

Here are the steps to connect to a MySQL database with a hostname via an SSH tunnel:

  1. Open Putty and establish an SSH connection to the remote server where the MySQL database is located.

  2. In the Putty configuration window, go to Connection > SSH > Tunnels.

  3. Enter the source port (e.g. 3306) under 'Source port' and the destination hostname and port (e.g. localhost:3306) under 'Destination'.

  4. Click 'Add' and then 'Open' to establish the SSH tunnel.

  5. Open a new command prompt or terminal window and enter the following command to connect to the MySQL database:

    mysql -h localhost -u username -p

    Replace 'username' with the MySQL username and enter the password when prompted.

  6. If the connection is successful, you should now be able to access the MySQL database via the SSH tunnel.

Note: Make sure that the MySQL database allows remote connections from the SSH tunnel source IP address.

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

Thank you for the instructions but I realize I need to clarify my question. 

 

As I stated in my original post, I already have the SSH tunnel configured. To connect to the database, I use the following command in terminal: 

mysql -h hostname --port = 1234 -u username -p

Once I enter my password, I can access the database no problem. 

 

To connect to the database in Power BI, the server and database name are required fields. Since this database requires the host name and port number to gain access, how do I include the hostname and port in the connection options in Power BI?

Did you ever find a solution?

The problem was with the database, there were additional firewalls that I could not get passed, even with the SSH tunnel. 

 

To test the database connection over an SSH tunnel, follow these instructions (in local Windows):

  1. Open Command Prompt
  2. Enter the following prompts:
powershell
Test-NetConnection hostname -port xxxx

 

If the connection fails, Power BI will not be able to connect to the database. 

Hi, do I need to follow the same steps to connect with an MongoDB Atlas cluster of my org?

Thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.