Protocol used by JDBC to connect to MySQL on different Host - mysql

I want to know what is the protocol that is used by JDBC to connect to MySQL Database that is present on an other host.
My client has only http and https access restricted to his host. I want an application on an other host to communicate with that MySQL Database available on my client's host.
Please note my Client uses WINDOWS 2012 SERVER
He has asked me the protocols and ports my application is using to connect to MySQL so that he would enable them.
Request you to help.

By default mysql server uses 3306/tcp port but this is configurable. They should open up only the port that the server is listening on. Regarding the protocol it is mysql specific, you can find more info at the official documentation

By default MySQL server listens on port 3306/TCP. See manual for more details.

MySQL uses its own binary protocol over TCP to destination port 3306 to connect to the database. If you cannot get a path open betwee your client and the server for port 3306 maybe you can get the server configured to use a port that IS available to you. It would depend on who has the stricter rules, the network admins or the DBA :-)

Related

Setting up MySQL database behind a VPN address

I have a regular MySQL server running with XAMPP at port 3306 and accessible by my internet ip aswell my local ip (127.0.0.1), the ports are forwarded in my router. An account set up to be accessed from any IP, Everything works fine.
I'm trying to make this same server be accessible by AirVPN DNS address. So I've followed AirVPN instructions to remove the forwarded ports in my router and forward a new port at their VPN with a random number (lets go with 1111) with local port as 3306 and DNS named as xxx.airdns.org
So I open MySQL with XAMPP under port 3306, nothing changed in config file. I run the AirVPN port checker over 1111 and it signals as open. I also try at other sites that checks ports and signals open at xxx.airdns.org:1111
Though when I try to make a connection as usual it returns error (10060): Can't connect to MySQL server on 'xxx.airdns.org' (10060)
Resolutions I've tried:
Switch port values in MySQL config files matching with the ports open in AirVPN
bound address to VPN adapter bind-address="10.6.114.48"
repeated the options above in all different kind of port combinations and addresses
Disabled Firewall on Ethernet adapter of VPN as described here
I couldn't achieve success in this task. I'm looking for some enlightment so I can understand the process.
EDIT:
The connection is set only to TCP protocol. A port check done through airVPN and is registered at XAMPP & FIREWALL logs as accepted connections. Though trying to connect from a client I got no log from Xampp or Firewall, it gets timed out.
Sorry for "answer" type not just comment, but i dont have enough reputation here :)
Maybe the protocol ( TCP/UDP ) is your issue.
If you use UDP on your airVPN better check forwarding on your router - most of them
by default sets TCP only. Otherwise maybe change to TCP on your airVPN.
ISP provider often filter this protocol.
Issue: Consider that you can't connect to a service running "behind" some VPN server from a machine that's connected to that very same VPN service.
Solution: Connect from another machine to test your service properly.

Reverse proxy based on DNS for multiple mysql hosts

I've some mysql host in private network and would like to use a reverse proxy server (i.e. nginx) to connect with mysql-client to mysql host via reverse proxy server.
An example to better understand my answer:
suppose I've:
a mysql server with ip yyy.1
a mysql server with ip yyy.2
both in the network of a proxy server with ip XXX, and I associate to XXX the DNS mysql-server1.com and mysql-server2.com.
My goal is connect to mysql server yyy.1 when I use mysql client to connect to XXX by calling mysql-server1.com on port 3306, and similare when try mysql-server2.com on port 3306.
The problem with nginx is that I can't differenciate TCP request by server name, so in XXX server I should associate one port foreach mysql server, but this implies that every time I should change the port also in mysql client settings, and I don't wanna this!
There's some proxy-server that can accomplish that?
Could I use IP Table to route the request mysql-server1.com:3306 to localhost:[some port], where I could use [some port] in proxy setting to forward the requests to the server yyy.1?
This is impossible.
In the MySQL Client/Server protocol, the client never identifies the hostname to which it is attempting to connect to. Unlike in some other protocols, such as HTTP (with the Host header), the original name the client used to resolve an IP address from DNS is not preserved. TLS SNI is also not available, because TLS negotiation on a MySQL connection does not begin until the client reads the server capability flags to discover whether the server supports TLS, at which point the client asks to switch the connection to TLS... and this, of course, is after the connection is is already established.
In the MySQL Client/Server protocol, the server always talks first.
Your only options are for the proxy machine to listen on multiple IP addresses, with a DNS hostname pointing to each IP, and use the address to which the client connected to determine which server to use.
Or, each proxy instance listens on a separate port.
The protocol design prevents name-based virtual hosting.

Unable to access port 3306 for mySQL Workbench

I have enabled this through windows Firewall. (I use Avast Free which doesn't have a free firewall) and I have went onto the BT router to port forward this too. Yet I still get system error 10060. I have downloaded PfPortchecker and checked port 3306 and apparently it's still not open.
I am pretty clueless on what to do here, any help is appreciated cheers.
If both MySQL Workbench and your MySQL server run on the same machine then you don't need to open any port on the modem or in the firewall. Focus on problems on your local machine.
First thing to check is: is your server actually running? Is there a service that starts the MySQL server? What setup is that? Did you install the server via the MySQL Windows Installer? If the server is running check the config file if TCP/IP networking is disabled for some weird reason (it should not, but who knows). If that is disabled you can only connect via a named pipe to your server.
Next step is to check is that the user you use to connect is actually allowed to connect from the local machine. Jeremy is right here, it matters if you use localhost or 127.0.0.1, especially if IPv6 is enabled on the box (where localhost resolves to ::1, instead of 127.0.0.1).

Is the standard mysql connection over port 3306 secure in Sequel Pro?

Simple question:
I use Sequel Pro to connect to my database in the cloud. If I use the "standard" connection method (over port 3306), is that secure, or will a packet sniffer be able to suss out my password? Should I only ever use "ssh" connections?
Thanks!
It's not default, but mysql does support ssl.
https://dev.mysql.com/doc/refman/5.5/en/using-encrypted-connections.html
So likely, yes, your credentials are flying around in plain text, and can easily be captured by a sniffer.
If you are unable to get your provider to configure mysql ssl, perhaps you can vpn first to the network where the mysql server lives, and then connect to 3306? Guess it depends on what options your provider gives you.

mysql access without webserver (ex. Apache)

I was wondering if there is a way to access a database service on a remote computer without having a webserver installed on that computer?
Does MYSQL DBMS provide some interface (port) which can be connected directly to, or is a webserver (that forwards the communication) mandatory?
MySQL can be access by default on port 3306.
Normally this port will be blocked by the firewall though, as it's not good practice to have your DB server accessible to the outside world.
If you want to access a remote database via the command line you can use the mysql client.
If you're doing this over the internet you should probably use a tunnel or VPN for security.
You can connect to MySQL using ODBC. Default Port 3306
As they said. You can connect with mysql using the (default por 3306). You may use mysql client, or the ODBC, JDBC, or ADO.Net interfaces. There are connectors for most of the main programing languages.
If you are looking for a user-friendly tool to use mysql like PHPmyAdmin you may like MYSQL GUI Tools
http://dev.mysql.com/downloads/gui-tools/5.0.html