access mysql in host from guest virtualbox - mysql

This is my scenario,
I have a Ubuntu 12.10 host and a win 7 guest installed in the virtual box. The Network is configured to be NAT in the virtual box. I have a mysql sever installed in the Ubuntu with “bind_address” in my.cnf is commented out.
How can I access this mysql server from the windows 7 guest? I did some search in Google and came accross with this Host-Only Networking With VirtualBox but I cant get it work as I don't have statics IP with my internet vendor and my network knowledge is very bad. All I know is that I have DHCP enabled Internet connection. So if i do any IP's in the network settings I don't have Internet.
I know that there are plenty of solutions on the other way around (access the guest server from the host) but still cant figure it out.
So any help is appreciated.
Thanks

Your external IP being static or not has no bearing to accessing a virtualized server on your LAN.
Set VirtualBox to bridge mode.
Simply determine your computer's DHCP-selected internal IP (usually 192.168.1.SOMETHING) and replace the last number with another that is less than 250. For example, if your computer was 192.168.1.6, 192.168.1.70 would work fine on the VM(pick a high number to void conflicts).
Set it by using the control panel->adapter settings. Reboot the VM. Connect to MySQL at 192.168.1.70(or the address you picked earlier).
Note: If your computer's address is in a different subnet (192.168.0.XXX, 10.XX.XX.XX, etc) change the last number and keep the first numbers the same as on the host.

Related

Can I set a static ip address for WSL 2?

I'm doing some Ruby on Rails development on a WSL 2. The rails app connects to a MySQL server running on my Windows host. When I used WSL 1 it as easy to set the host to 127.0.0.1 but on WSL 2 I have to use the nameserver written in /etc/resolv.conf
But I found out that IP address written in resolv.conf changes on reboots.
Is there a way to set a static IP address for WSL 2 ?
You can consider ocroz/wsl2-boot (see INSTALL for installation instructions)
After running wsl-boot command:
The WSL network is configured as per its predefined definition always (Windows side),
All WSL hosts are configured with their predefined static IP always (Linux side),
All WSL hosts and connected Hyper-V VMs can talk to each other always,
The DNS resolution works however you are connected to Internet or VPN,
You can SSH to WSL host without any delay.
Dec. 2022, microsoft/WSL issue 4210 also adds:
With the latest Windows 11 (22621+), you can already specify the network adapter you want to use for WSL2 in .wslconfig:
[wsl2]
networkingMode=bridged
vmSwitch=my-switch
ipv6=true
So, now you can create a Hyper-V external virtual switch for WSL2 and fix the IP address, no other scripts are required. It works out-of-box.
The same thread adds:
Create a vSwitch in Hyper-V,I Use Hyper-V Gui to do this. Hyper-V has three types of virtual switches -- external, internal, and private.
I choose the "external" type , which is bridge type, the same as VMWare workstation.
set this config in .wslconfig
I find the IP change to the network of my home router,which is replace the old of eth0.
You can set DHCP in you home router, then Fix the IP of the bridge.
To sum up, in the case of bridge, it is essentially DHCP , and whether it is fixed or not depends on the DHCP server.
If you don't want /etc/hosts, /etc/resolv.conf to change after restart, you can create
/etc/wsl.conf
[network]
generateHosts = false
generateResolvConf = false

Is it mandatory that a mysql server have a static IP address? (client is on same local machine)

I am using a software - (Ingress) by FingerTec which uses mysql database.
Some setups of this system are only using a single installation - consisting of a mysql server and a client locally on the same machine.
I have been having issues since I started to use the software when it is installed on a user's laptop/PC. The problem is that frequently when running the mysql server and client, a window pops up asking for the local IP address and port (127.0.0.1 and 3306 by default). To continue using the software, one needs to run IngressDB installer where you need to 'Update Connection' by giving the root user and pass for mysql and then 'Upgrade Database' to refresh the database for any new settings. After this step the software runs fine.
Yesterday I managed to simulate this issue by changing the static IP on my laptop while connected directly to one of their Access Controllers. I had to re-Run Ingress DBinstaller.
Now my question is this:
When using your machine(laptop/pc) it is normally getting IP add, def GW, Subnet etc from a dhcp server therefore there is no guarantee that you will always get the same IP leased unless there is a reservation to the machine's mac address.
As described earlier - when ever there is a change of IP address leased from DHCP, a window pops up showing the loopback address 127.0.0.1 and the mysql port 3306. So it never shows the local IP address (ex. 192.168.1.100). So I was thinking - why is the loopback IP not enough for mysql client/server as this stays the same forever.
Is is normal that software using mysql database server requires a static local IP on the machine hosting it? I am referring only to instances where both mysql server and client reside on the same machine.
I appreciate your thoughts about this and maybe any other way I can get around this apart from making an IP address reservation in the DHCP server. Setting a static IP address manually on the LAN adapter is no solution for me as this would limit the machine to connect only to a certain network and cannot be used at other places.
If the client is the same local machine as the server, the MYSQL server specifically does not need a static IP because it pretty much already has one: 'localhost' or '127.0.0.1'. If the client is not on the same machine as the server, the server would need a static IP.
If the machine is acting as a server for other content, yes, it would need a static IP. If you're doing this at home, chances are that your access point will let you configure it for a static IP.

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.

Amazon ec2 hosting server ip address

I am a beginner in linux and I need to upload my JavaEE project on Amazon Ec2 hosting. I am using putty to connect to the server and successfully installed mysql and tomcat. What I need now is to access the tomcat server i.e., http://ipaddress:8080. Can Anybody tell me how to know the ipaddress of the server to access the tomcat server installed. I have used grep --color nameserver /etc/resolv.conf to get the ipaddress but If I type http://ipaddress (from the command):8080 it says the site cannot be reached. Can anybody help me with that.
Regards,
The IP Address is similar to the below, found under Instances / Instances:
The Security Groups you have set up are Located under Network & Security / Security Groups:
Note that in the above, port 3306 can only be reached by one hard-coded IP Address, whereas port 110 is reachable from anywhere. Please also see CIDR.
To hook a certain Security Group into a running instance, perform that off the first screen shot, lower right.

Is it possible to redirect ODBC connections to another IP address

We have a building full of computers, each of these computers has a number of ODBC connections setup pointing at a MySQL server at a certain IP address.
We want to move this MySQL server to another machine and we are wondering if there is a way to set something up at the original IP address to redirect any ODBC connections pointed at port 3306 to the new machine.
Some background, both the old and new servers are Windows Server 2003. The MySQL server is part of a legacy system, we are replacing this with a SQL server but the MySQL needs to remain operational for the forseeable future.
The alternative is to spend a day going around each computer and amending the ODBC connection strings, which I will do if I need to but thought I would ask on here first.
Thanks
You have a few options, most of which are network related, not software.
In the future, consider using a hostname rather than an IP address for configuring your ODBC settings. This allows you to utilize DNS to resolve a hostname to any IP address that you want.
Besides that, MySQL proxy may be what you are looking for.