LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-07-2015, 04:54 PM   #1
tearsforhari
Member
 
Registered: Mar 2015
Posts: 79

Rep: Reputation: Disabled
Access mysql db on Ubuntu 14.04.3 as VM of Windows Server 2012


I am running Ubuntu 14.04 as a virtual machine (VM) running off of Hyper-V on Windows Server 2012. I have installed MySQL (LAMP) on Ubuntu. My IP addresses are set to 127.0.0.1 for localhost and 127.0.1.1 for the machinename. I also have installed workbench on Windows Server 2012. I would like to have Workbench directly access the MySQL database on the Ubuntu VM on the same machine. How do I do this?

I read on another post that I need to do the following in MySQL:
GRANT ALL ON mydb.* TO remoteuser@'%' IDENTIFIED BY 'SomePASSWORD';

But I am unclear on whether I need to change the IP addresses. I think it shouldn't matter, because I am not connecting to the internet. But maybe localhost for Windows is being confused with localhost for Ubuntu....? Do I need a router and set an IP address or can I directly access the VM from the Windows host? Please help.
 
Old 09-08-2015, 07:05 AM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,657
Blog Entries: 10

Rep: Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075
Quote:
Originally Posted by tearsforhari View Post
I am running Ubuntu 14.04 as a virtual machine (VM) running off of Hyper-V on Windows Server 2012. I have installed MySQL (LAMP) on Ubuntu. My IP addresses are set to 127.0.0.1 for localhost and 127.0.1.1 for the machinename. I also have installed workbench on Windows Server 2012. I would like to have Workbench directly access the MySQL database on the Ubuntu VM on the same machine. How do I do this?

I read on another post that I need to do the following in MySQL:
GRANT ALL ON mydb.* TO remoteuser@'' IDENTIFIED BY 'SomePASSWORD';

But I am unclear on whether I need to change the IP addresses. I think it shouldn't matter, because I am not connecting to the internet. But maybe localhost for Windows is being confused with localhost for Ubuntu....? Do I need a router and set an IP address or can I directly access the VM from the Windows host? Please help.
Change what IP addresses?
I wouldn't.
Quote:
Originally Posted by tearsforhari View Post
GRANT ALL ON mydb.* TO remoteuser@'%' IDENTIFIED BY 'SomePASSWORD';
is insecure on an internet facing system, but should be ok for your arrangement.
Code:
GRANT ALL ON mydb.* TO remoteuser@'<windows_box_IP>' IDENTIFIED BY 'SomePASSWORD';
is the more secure on any forward facing system.

The mysql in the VM should have a non-routable IP attached to it.
What kind of network did you give this VM and what virtualization software did you install?

Last edited by Habitual; 09-08-2015 at 07:06 AM.
 
Old 09-08-2015, 11:09 AM   #3
tearsforhari
Member
 
Registered: Mar 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
My IP address for MySQL in the VM is 127.0.0.1 (i.e. the binding-addess in the /etc/mysql/my.cnf)

I created an 'internal' virtual switch in Hyper-V, which runs the VM.

But I keep getting a fail to connect.
 
Old 09-08-2015, 11:21 AM   #4
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,657
Blog Entries: 10

Rep: Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075
Sorry, I don't know Hyper-V stuff.
but... 127.0.0.1 is a non-routable IP for localhost.
Every host has one. To reach the machine you'll need to
rem out the bind-address in /etc/mysql/my.cnf on the guest VM,
then restart mysql-server on the guest.
Then connect to the guest machine's assigned
IP in one of the following classes:
Code:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/24
Once the guest VM has an IP in one of those ranges,
then use the 192.x.x.x, or 172.16.x.x or maybe even 10.x.x.x as the "hostname" in the connection properties
of mysql workbench for the Guest VM.

Sorry, wish I had more.

Last edited by Habitual; 09-08-2015 at 11:24 AM.
 
Old 09-08-2015, 11:24 AM   #5
tearsforhari
Member
 
Registered: Mar 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
What does "rem out the bind-address" mean?
 
Old 09-08-2015, 12:38 PM   #6
tearsforhari
Member
 
Registered: Mar 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
When I change the bind-address in my.cnf to 192.168.0.1, mysql does not restart in Ubunut. Any further suggestions?
 
Old 09-08-2015, 01:16 PM   #7
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,657
Blog Entries: 10

Rep: Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075
Leave it alone then.
Did you run this on the guest VM > msyql ?
Code:
GRANT ALL ON mydb.* TO remoteuser@'<windows_192_IP>' IDENTIFIED BY 'SomePASSWORD'; flush privileges; exit;
Try 192.168.0.1 in "hostname" in the connection properties of mysql workbench.
 
Old 09-08-2015, 02:02 PM   #8
tearsforhari
Member
 
Registered: Mar 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
Ok. Got it to work by obtaining an external IP address from the router. But what I want to do is to close the outside world and directly have Windows Server host and the Ubuntu VM talk directly to one another. I know you can do this by creating a internal virtual switch (maybe). I am not getting that part to work. Right now, I am tying to set a static IP address in Ubuntu. I guess my question is how to I set my IP address in Ubuntu?
I am trying:
Code:
vi /etc/host
Also, if I disconnect my ethernet cable when I reboot Ubuntu, it hangs for 60 sec trying to find an IP address. How do I avoid that?
 
Old 09-08-2015, 06:43 PM   #9
tearsforhari
Member
 
Registered: Mar 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
Still having trouble getting the Internal Virtual Switch to work. I set an TCP/IPv4 address in Network Connects in Windows. I can ping myself. But I cannot ping the static address I gave in the VM. And vice versa.. Neither machine seems to see the network card. However, if I use DHCP to assign the IP in Windows and Linux, then it works. I cannot figure what is out being done properly. Any suggestions?
 
Old 09-08-2015, 07:24 PM   #10
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,657
Blog Entries: 10

Rep: Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075
192.168.0.1 is closed to the outside world.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup a Windows Server 2012 R2 domain file server? riahc3 Linux - Software 4 04-14-2015 04:16 PM
rdesktop and Windows Server 2012 312 Linux - Desktop 2 09-23-2013 05:07 AM
Windows 8, Windows Server 2012, and Office 2012: Estimated RTM Dates Surface on an MS nixfreakz Linux - News 0 01-31-2010 11:15 AM
LXer: Windows 8, Windows Server 2012, and Office 2012: Estimated RTM Dates Surface on LXer Syndicated Linux News 0 01-30-2010 04:30 PM
Ubuntu Server with Samba, Windows PC's cant access server! elliotfuller Linux - Networking 1 09-10-2005 07:40 AM


All times are GMT -5. The time now is 11:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration