Cannot connect remotely to my SQL server remotely - mysql

Well, first off, I am no programmer. I am a medstudent with decent computer knowledge, and that has done this at least one time before in his home network.
Now, i am doing some research at the hospital, and for my database i want to use mysql, running a server on a local network computer and being able to connect to it from laptops over wi-fi to work on the database.
So i download mysql installe, run it, and i connect via localhost perfectly well with the root acc or the set up accounts i will use. I do bind-address to change its ip to the computers IP on the network, and i can connect again with root and with my accounts perfectly well on the machine the same server is on, using xx.xx.xx.xx + port to connect, with root and all other users.
however, using workbench on a laptop connected to the local network, I cannot connect with any user, it always gives error 10060.
--Firewall is off
--All AV software is off
--accounts are set up correctly to allow connection from any host
--client PC can ping server PC
--Netstat -anob shows mysqld.exe listening on the port i need it to be listening
The network here does block connections, but the port im using is open due to the fact it is used for another server type application that as very little to no traffic, so i just grabbed the opened ports for that application as they showed up in netstat and configured te server to use one of those ports.
How can i make sure the server PC is open at those ports?
THe client im trying to connect with is either the mysql workbench or heidisql.
Neither can connect, however i have succesfully used heidi before to connect to a database I have in DB4free.net. I cannot use that at the hospital, because the network shuts off the default port for mysql which is what db4free.net uses.
Any ideas why i cant connect to that PC?

mySQL often does not come configured for remote connections by default. The port may be open, but if mySQL isn't listening or is set to reject all remote connections, you won't be able to connect.
Check the documentation for your version of mySQL to find out how to modify your mySQL server's configuration to allow remote connections.

Related

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.

MySQL connection works for Workbench but not Tomcat Application using same credentials

I am working on a remote Redhat system over SSH. Tomcat 7 and MySQL 5.5 server are both installed and appear to be running correctly.
I can connect to MySQL from a local install of Workbench over SSH tunneling using localhost and a defined MySQL user. I can run queries and navigate tables without incident.
When I try to connect to the same MySQL Server with a Tomcat application running in the same environment using the MySQL defined user (same credentials) that Workbench is connecting with successfully, it fails.
At this point I don't know the exact error message that gets generated (I am not an admin) so any guidance here is appreciated.
My question is why can I connect with Workbench (which is effectively connecting locally), but not with my Tomcat application, which actually is local to the server?
Might it be a permissions issue with the context Tomcat is running under?
References:
Connection string example (credentials have been altered):
jdbc:mysql://localhost/mysql_database_name?user=ApplicationUsername&password=ApplicationPassword"
Furthermore, I have verified that
mysql-connector-java-5.1.27-bin.jar
is in the WEB-INF folder, and:
Class.forName("com.mysql.jdbc.Driver");
resolves.
This web application works in both dev and test on another server connecting using respective credentials.
Be sure the port number of mysql server exists in connection string. Normally if port is not specified, default value would be used as 3306. Maybe your mysql runs on different port?
jdbc:mysql://[host][,failoverhost...][:port]/[database] »
[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
If the host name is not specified, it defaults to 127.0.0.1. If the port is not specified, it defaults to 3306, the default port number for MySQL servers.

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.

MySQL does not work on localhost without Local Area Connection

I use WampServer (Apache, PHP, MySQL) and have no problems when some kind of network adapter(wireless or lan) is connected (i.e. Local Area Connection has status connected) even if i am not connected to the internet (for example when i am connected to the router but that is not connected to the internet).
When there is no network connection, I get a php error like MySQL could not connect to 127.0.0.1 on port 3306.
Interestingly, telnet 127.0.0.1 3306 says that it could not connect to the port, even when the server and MySQL are running fine (i.e. when some kind of local area connection is connected).
So I turned off all kinds of firewall (antivirus and Windows) but still no difference in anything. And that is why this issue is quite puzzling.
Things I have already tried (will update this list along the way):
The skip-networking directive in my.ini.
You could modify your MySQL server and client configuration to connect to one another using a named pipe instead of a TCP/IP loopback connection. That way, the current state of the network connection should have less impact.
To do so, start the server with --enable-named-pipe or the corresponding config file setting, and execute the client with --pipe or --protocol=PIPE. Similar configurations should be available for your PHP connector as well. It may depend on which library you use there, and whether or not it will take the mentioned configuration settings from the my.ini file (settings without leading -- there).