Is Windows blocking access to a remote MySQL server with a firewall? - mysql

I have an interesting issue connecting to a MySQL database remotely on my Windows 7 machine at work.
I'd like to connect to a remote MySQL database stored by hostpapa. At home on my mac, I use the following code successfully (after ensuring that my home mac IP address is an allowed user on the database side):
library(RMySQL)
# Connection Database SQL with RStudio
db <- dbConnect(MySQL(),
user='admin',
password='mypassword',
dbname='admin_dbase',
host='mywebsite.ca')
It connects to the database and I'm able to view tables, etc.
In Windows - same code - no luck. Error message is:
Error in .local(drv, ...) :
Failed to connect to database: Error: Can't connect to MySQL server on 'mywebsite.ca' (0)
I've attempted to add RStudio and R to the Windows Firewall as "allowed programs" and I've also gone to Windows Firewall -> advanced settings -> Inbound rules -> New Rule -> and added a TCP Port for port 3306. (I also tried adding port = 3306, as an argument in the dbConnect call).
Now, I know these credentials work on my mac, so it's gotta be something to do with the settings on my Windows machine. Also, the error message doesn't say there isn't a MySQL database, it just complains it can't connect.
Any ideas on how to convince my work machine to play nice?
Note - *I'm new to connecting to databases, so a descriptive answer would be much appreciated!**

Related

"Cannot Connect to Database Server" error connecting from MySQL Workbench to SiteGround MySQL Database

Situation:
I am trying to connect to my SiteGround server MySQL database directly from my local machine using MySQL Workbench. I am positive that the connection properties are entered correctly as the connection works if I am connected to Network A (phone data plan). But with Network B, the connection failed.
I allowed remote access to my server from my Network B IP, in fact, I allowed all IPs just for testing, therefore Network A is working.
I checked if there is any setting that blocks the port from my router and modem in Network B, but I found nothing.
I tried running netstat: nothing with port 3306.
I tried running telnet: "connect failed"
Question:
I am suspecting that my ISP has blocked the outgoing port 3306? Is there anything I can do to "unblock" it?
Or is there any workaround for connecting to my server database?
My connection set up screenshot:
Error screenshot:
Thank you in advance for your time and help!!

SSH tunnel to MySQL database

We're in the process of setting up Tableau connectivity to our company's sales database and so far, the people that have been attempting to connect (they're from some other company) keep getting denied. The errors they're getting are as follows.
Unable to connect to the ODBC Data Source. Check that the necessary drivers are installed and that the connection properties are valid.
Can't connect to MySQL server on '[IP address] (61).'
Unable to connect to the server '[IP address].' Check that the server is running and that you have access privileges to the requested database.
Today we opened ports 3306 and 20560. We were hoping we could set up some kind of port forwarding thing so that they connect to 20560. I'm not sure what we need to do to set that up, however. I was also told that SSH tunneling is an option, but connecting with PuTTY doesn't yield any results.
I'm at a complete loss as to what I need to do to allow them to connect. I'm also not sure that opening port 3306 is safe and I'd like to know if I should have it closed. I randomly picked port 20560 because it's not being used for anything. We don't want just anyone to connect, but I've been told that the IP address connecting to our database may not be static.

How to fix 'Can not connect to MySQL server' error?

First of all I apologize for my English is not perfect.
I'm trying to connect to mysql database remotely.
I have already done the basic steps such as, for example, comment the bind address in my.cnf.
I gave permissions to the appropriate users in MySQL.
I tried with my friend to do it connect to the database, and it worked but we were in the same room with the same router.
Now I'm home and I tried to connect my friend, but I always get error:
ERROR 2003 (HY000): Can not connect to MySQL server ....
Maybe it's a problem of my home router? I can not even do the telnet.
P.S. I've also taken steps to set the firewall.
Some reasons for that,
mysqld is not running on the local host. Check your operating
system's process list to ensure the mysqld process is present.
You're running a MySQL server on Windows with many TCP/IP connections
to it. If you're experiencing that quite often your clients get that
error, you can find a workaround here: Section B.5.2.2.1, “Connection
to MySQL Server Failing on Windows”.
Check whether the server is running on that host by executing telnet
some_host 3306 and pressing the Enter key a couple of times. (3306 is
the default MySQL port number. Change the value if your server is
listening to a different port.) If there is a MySQL server running
and listening to the port, you should get a response that includes
the server's version number. If you get an error such as telnet:
Unable to connect to remote host: Connection refused, then there is
no server running on the given port.
Look at this mySQL full documentation, it will be helpful.

Unable to connect to MYSQL on a remote computer

I am working on windows and having a remote desktop connection of another machine. I am trying to connect to the mysql running on the remote machine through my MySql workbench, installed on my machine.
When I specify the details to connect to mysql i.e.
IP- a.b.c.d
port-3306
username=root
password=
But everytime it shows me an error saying-
Your connection attempt to connect to user='root'failed from your host to server at a.b.c.d:3306
Is it possible that I can connect to mysql on a different machine?
Certainly that is possible, mysql is a network transparent service. However obviously the normal access authorization rules apply.
do you have network access to the mysql port, this might be blocked by a firewall. You can check that by using telnet ip-address-of-server 3306. Does the server answer or do you get a timeout or are blocked? (the answer would look cryptic, soomething like 5.5.33-MariaDB[*[n7p~g!�iXccI$r9``Y{$mysql_native_password or similar )
the mysql server can be configured to not listen to remote connections. This can add security to the setup, but would obviously block any remote connection attempts. You will have to check the configuration files of mysql for that.
mysql itself implements an authorization level. So check if that 'root' user actually is allowed to connect from the outside. Those authorizations are stored in the internal "mysql" database.
Also it is not clear from the question what your network topology is: is the mysql server running on that system you have a "remote connection" to? Is the mysql-workbench running on that remote system or on your local system? This might affect the ip address you have to use inside the workbench.

Sql Server 2008 remote access problem

I have problem with connecting to Sql Server from my local machine.
Seems like I did everything I could, but still I'm unable to connect to it.
This is what I did:
1) Right click on Sql Server in Sql Management Studio (SMS) -> Connections -> Allow remote connections
2) Right click on Sql Server in Sql Management Studio (SMS) -> Security -> Allow remote connections -> Set Auth mode to Win and Sql auth mode (i.e. mixed mode)
3) Disabled firewall
4) Sql Server Configuration Manager -> Network Configuration -> Protocols -> Enable Shared memory, Named pipes, TCP/IP
5) Sql Server Configuration Manager -> Network Configuration -> Protocols -> TCP/IP -> Properties -> Set TCP Port to 1433, Set TCP Dynamic Port to 0. After that I restarted MainSql service in "services.msc"
6) I ran "EXEC xp_readerrorlog 1" in SMS, found this:
Server is listening on [ 'any' 1433].
Server is listening on [ 'any' 1433].
Server local connection provider is ready to accept connection on [ \.\pipe\SQLLocal\MAINSQL ].
Server named pipe provider is ready to accept connection on [ \.\pipe\MSSQL$MAINSQL\sql\query ].
Server is listening on [ ::1 64825].
Server is listening on [ 127.0.0.1 64825].
7) Tried to telnet [myip] 1433 from my home machine. Result: connecting To [myip]...Could not open connection to the host, on port 1433
: Connect failed
8) Tried to telnet [myip] 1433 from server - it worked!
Seems like this is some kind of a network issue. I have another server with Sql Server installed, I did the same on it and I was able to connect to it from my home machine, but not this one! I tried to connect to this server from the second one and it didn't work too.
Please help me, I don't know what to do. I did everything I could but it still doesn't work.
Update:
Sql Server Browser service is started on the server machine. The server is a dedicated server at a hosting, I'm trying to connect to it from my home machine and from another server witch is a dedicated server as well, from another country.
The problem was in firewall. To fix it I ran a script from here: http://support.microsoft.com/kb/968872
This is really strange because I fully disabled server's firewall. However it now works for me, thanks to cairnz and Gregory A Beamer for help.
It looks like you hit one of two most likely causes: You have set protocols. Just double check the client side to ensure the same protocols are enabled on both sides and you are done there.
The second most likely, with SQL 2005 on, is the Browser service is turned off on the server. If this is true, you will often have issues with remote calls, ala http://support.microsoft.com/kb/914277.