LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 03: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, 06:05 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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 06:06 AM.
 
Old 09-08-2015, 10: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, 10:21 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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 10:24 AM.
 
Old 09-08-2015, 10: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, 11:38 AM   #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, 12:16 PM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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, 01: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, 05: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, 06:24 PM   #10
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

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


Reply



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 03:16 PM
rdesktop and Windows Server 2012 312 Linux - Desktop 2 09-23-2013 04:07 AM
Windows 8, Windows Server 2012, and Office 2012: Estimated RTM Dates Surface on an MS nixfreakz Linux - News 0 01-31-2010 10:15 AM
LXer: Windows 8, Windows Server 2012, and Office 2012: Estimated RTM Dates Surface on LXer Syndicated Linux News 0 01-30-2010 03:30 PM
Ubuntu Server with Samba, Windows PC's cant access server! elliotfuller Linux - Networking 1 09-10-2005 06:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:56 PM.

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
Open Source Consulting | Domain Registration