MySQL Remote Connection (Replication) - mysql

I have the following topology.
One Ubuntu 16.04. Instance on the Amazon AWS where my global MySQL Server is running. I want to use this Server as a Slave (Multi-Source Replication) for many local Master (Windows Machines MySQL Server).
For Testing Reasons I`ve Managed to make this running on one local Machine (with three different MySQL Server Running).
But now I want to make this Replication work on the mentioned global Server with the local ones. But it fails on the attempt to connect from the EC2 ubuntu Instance to the local Windows MySQL Server.
When I try to connect from my EC2 Instance to the local Computer with MySQL running on Port 3307 it keep saying:
ERROR 2003 (HY000): Can't connect to MySQL server on (113)
The strange Part is, that I can PING the Local Computer but not telnet it.
Telnet just says:
telnet: Unable to connect to remote host: No route to host
I can access the Global (EC2 / Ubuntu MySQL Server) from the local Machine but not the other way around.
I`ve already made a new Rule for this Port on the Windows Firewall Settings.
But the Port 3307 on the IPv4 Address seems to be still Closed.
I have no clue what I am missing to get a Connection from the EC2 Instance to my local Computer via TCP.
Do I have to open the Port Specific on the Router?
I hope for your help.
Best Regards.

It seems like your local computer is not visible, as your incoming ports to your local pc are closed. It may be a problem with your router, or your internet service provider, which is not allowing you to open ports(the most common one).
The possible solutions are:
1.) If your ports are not open due to the router
Try forwarding required ports to your pc.
Try Switching off your NAT firewall that may be blocking ports.
Try switching off your windows or antivirus firewall if any.
2.) If your ports are blocked by your Internet service provider.
Try getting help from ISP
Switch to a static IP connection if on dynamic.
Use a VPN service that provides an unblocked port service to all IPs.(This one solved my problem when I was struck in this situation.)

Related

MySQL:Error 2003 lost connection from a virtual machine on the same localnetwork

Apologies for the bad english, i'm french. :D
I've been looking for an answer since approximatively 4 days, and I don't know how to fix my issue.
So:
I want to virtualize two servers using virtualBox on Windows7 and i want them all on the same local network.
My VMs are running on Ubuntu 16.04
On the first VM I installed a lamp web server with MySQL 5.7 and i add phpmyadmin.
On the second VM I installed Jira standalone
--> I need to connect to my Database from my Jira server
So I used the Bridge adapter on each machine:
network configuration
network configuration
Ip adresses are attributed with the DHCP protocol.
The SQL machine ip is 192.168.6.80
The Jira machine ip is 192.168.6.101
The Host machine ip is 192.168.6.87
I'm able to ping each machine so there is no problem.
SQL server
When I start the machine everything seems to work, i can access from my SQL server:
localhost : home page of apache 2 saying "It Works"
localhost:5671 :
[���
5.7.18-0ubuntu0.16.04.1� ���UKBeM�ÿ÷�ÿ����������T(DGKg1hwd=�mysql_native_password���ÿ„Got
packets out of order
localhost/phpmyadmin : the index page where I can connect perfectly with root.
Host Machine (Windows)
192.168.6.80 : home page of apache 2 saying "It Works"
192.168.6.80:5671 :
[���
5.7.18-0ubuntu0.16.04.1� ���UKBeM�ÿ÷�ÿ����������T(DGKg1hwd=�mysql_native_password���ÿ„Got
packets out of order
192.168.6.80/phpmyadmin : the index page where I can connect perfectly with root.
Jira server
Here when i start the machine it works during approximatively 2-3 minutes,
I'am able to connect via:
mysql -u root -p -h 192.168.6.80 -P 5671
I am perfectly connected and i can also access to all the other adresses.
And then it stop working on this machine only.
Unable to connect
Firefox can’t establish a connection to the server at 192.168.6.80.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
And when i re-try to connect via mysql on terminal I get the Error 2003 (HYOOO)
This happen only when i use the connection of my work, at home it works perfectly without stopping!!
I have few leads:
problems of proxy authentication
problems of firewall configuration
i am in a private network with a domain name called something.eu
And when i launch firefox the proxy shows up automatically:
and-etc-ha.something.eu:9090
So i'm invited to enter my id and password.
My id is : luc.myName#something.eu
After that i'm connected to internet with firefox but not in terminal when i want to use apt.
I search on the web and i found this:
export http_proxy="http://Username:password#proxyip:port/"
and
export http_proxy="http://Domain\user:pasword#proxyip:port/"
So I tried different ways and i was able to download with apt. But the internet connexion with firefox was unstable. But if I use firefox on my host machine the connexion is perfect.
I also tried with settings -> network -> network proxy -> method manual
http: and-etc-ha.something.eu port: 9090
I don't know if I was understandable, tell me!^^
If you have any ideas to help me to solve this problem let me know.
Bye!
I found the cause: In fact there was a ip conflict inside the LAN because the DHCP was giving in-use ip address.
I decide to use the NAT connection with Port Forwarding on VirtualBox.
With that configuration I'm able to access my VMs on my LAN using the host ip address followed by the port of my choice.

Fail to access remote server from another remote server

I have a remote server to which I need to connect to. Let's say the hostname is Remote01. From my local, I am connecting to it via a VPN (Juniper). I have another remote server in my intranet which is an RHEL server. I loginto this RHEL server (let's call it Remote02) and in the command line I type:
ping Remote01
This returns
ping unknown host Remote01
Do I need a VPN installed in Remote02 as well?
You would need to install the VPN client on Remote02 as well in order to reach Remote01.
Or, if you're comfortable changing the routing table and firewall of your own server/machine, you can changing the routing table on Remote02. For the network of Remote01, instead of going to the default gateway, point it to your local machine. On your local machine, modify the firewall to accept incoming packets from Remote02 to forward to to Remote01 via the existing VPN connection.
I would say the first solution is much simpler. But if for some reason, the VPN client is not available on Linux then you can try the second solution.

Mysql Connecting remotely

I'm having a problem running a MySQL server that is hosted on another server that isn't the web hosting server. Currently my web server is running on godaddy's free linux hosting. They do offer a MySQL database free, but you can't connect remotely (Sequel Pro OSX program) without paying for an upgraded hosting plan. So temporally, I'm going to host the database on my server at home (XAMPP). Well, whenever I try to connect to the database using the PHP command mysql_connect() I'm getting an error:
"Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110"
before it was saying 113 (I believe).
Any-who, I tied to use the 'Bind-address' and changed it from 12.0.0.1 to my LAN IP. it didn't work or I didn't do it right. So, any help I can get on this would be awesome.
FYI, I can connect to the database remotely from inside my network using Sequel Pro. But the godaddy server can't connect. Port is open also, so that's not the problem.
Out of the mouth of a godaddy support guy, "Our shared hosting plans do not give you the ability to connect to an external database. If you wish to have this ability, you would need to look into one of our server hosting options."
So, my configuration is correct, it's just godaddy has it blocked. Lame! Thanks everyone for the help.
If you're hosting your database to a home local machine, you should also redirect router "xxx" TCP port to 3306 TCP port of hosting pc.
Remember you must connect to WAN ip on port "xxx".
You can use free dns services like dyndns to map your internet connection to a name (example yourname.dyndns.org)
Redirect a port (default 3306) of your router to 3306 TC port of your hosting pc (internal)
From remote pc connect to yourname.dydns.org:3306 or to port you redirected on router

Connect Amazon EC2 to my Local MySQL Database

Is it possible to do the following?:
I have a local Mac running OS X Lion with a MySQL Server installed which runs different processes regularly and stores data into a local DB.
On the other hand I have an Amazon EC2 instance.
What I would like to do is to use the Amazon instance to perform certain cronjobs (using its own resources) but connecting to the data that is on my localhost (my computer) and performing basic SQL actions like updating the data, inserting, etc.
I don't know if this helps, but I have a static IP. Is there any way I can "open" my IP so the Amazon instance can recognize my home computer as a valid MySQL server?
Thanks for your help, any tip in the right direction will be much appreciated.
If your EC2 instance is connecting to your local db you'll need a static IP locally. Well not need... but if you don't have it anytime you reset your router or loose power etc your ip will change. You can look into Dynamic DNS as well for your local instance.
Your ISP will not block your port on your local instance. This would be a firewall inside your network that is preventing you from connecting to mysql or a configuration with mysql itself. Users can only connect to mysql from certain IP addresses.
You would have to open up the mysql port on your firewall if you are using one, have the mysql client installed on your EC2 instance, and make sure that the user that had proper grantable permissions.
That said why not run cron locally on the mac?
If you can login to your server via SSH then there's no need to open any other port and no static IP is required. You can use SSH port forwarding instead. From your local machine run:
ssh -C -R 5555:127.0.0.1:3306 <your-server-host>
Now you should be able to connect to your Mac's database running on localhost:3306 from the remote server at localhost:5555.

Cannot connect to remote mysql from Mac lion

I'm a mac novice and trying to get a developer setup to develop php sites locally. The sites he develops have a mysql backend and that is on a remote box. We got xampp installed and working, he can connect from the website to the local mysql box but he cannot connect to the remote box. He is using the exact same connection info I am using from my windows system. I do not have any issues. Also the mysql server is setup to accept all users (we are currently using root) regardless of hostname.
I searched his system and I could not find a mysql.sock file. I do not know what this does, but googled some articles that mentioned.
Please help if you can.
Try Telnetting to the server from your host and see if you get a response.
telnet host 3306
If that doesn't work, you probably have some local firewall on your mac that is blocking the connection. Also, one thing you don't mention is that you can connect from a windows computer and not a mac... are they on the same network? If they're on different networks or in different places, that could indicate a local network issue.
This is definitely not an issue with mysql, but with something on the Mac itself.
The mysql.sock file is relevant only to the machine the MySQL server is running on, for local clients to communicate with the server. For any remote machines, they'll be connecting via TCP on port 3306.
Make sure that port 3306 is open in the server machine's firewall, and that MySQL has been configured to allow TCP connections.