Solved

How can I connect Workbench to a MySQL database inside an Ubuntu VMWare VM?

Posted on 2011-03-04
8
2,551 Views
Last Modified: 2012-05-11

Apologies for the novice question, but I'm new to MySQL and Ubuntu, so still feeling my way around!

We've set up an Ubuntu Virtual Machine on a Windows XP PC, and have installed OpenEMR on it, which is an open-source LAMP medical records application.  (The idea is to use this VM as an appliance, containing the back-end.)  I can successfully use a browser to access the application, and thus create/edit/delete records in the MySQL database, but when I try using Workbench to 'remotely' administer MySQL from the Windows XP side, I can't seem to connect...

I really need to be able to remotely administer the database inside this VM, and am also keen to set up an ODBC link to it (yes, please don't hit me, but I want to map some of these tables into SQL Server!).

Very grateful for any help anyone can give me - note that I *don't* have workbench installed *within* the VM, so if there's a solution that avoids me having to do that, even better.

Many thanks, Sam.
0
Comment
Question by:samueldjohnson
  • 4
  • 3
8 Comments
 

Author Comment

by:samueldjohnson
ID: 35037575
PS - sorry, should add a few more details.  On the 'Setup new connection' screen, I'm using:
- 'Standard (TCP/IP)' connection method
- the VM's 'VMnet1' IP address as the hostname
- user 'root' with appropriate password (which I'm told is the equivalent of 'administrator' in Windows)
- the default port (3306)
I've left everything blank on the 'Advanced' tab.

The error I'm getting is "Can't get hostname for your address".

Cheers, Sam.
0
 
LVL 6

Assisted Solution

by:Patrick Tallarico
Patrick Tallarico earned 100 total points
ID: 35037615
Do you have access to the modify the setup of the VM.  If so, check the my.cnf file for the bind_address.  If it is only set to the local machine, then you won't be able to access it from another machine.  The web service can access it however, since the web service is technically requesting it from the same machine.  
I would also warn that depending upon this OpenEMR's best practices it may be considered a security hole to open up a pathway directly to the mysql server.
0
 
LVL 4

Accepted Solution

by:
Tomun earned 400 total points
ID: 35038478
as stpmt11 says you'll need to change the bind_address. Set it to 0.0.0.0 and restart mysql (sudo service mysql restart)

You'll also need to allow a user to connect to mysql from another address. Start the mysql command line client (mysql -u root -p) and enter something like:

grant ALL on *.* to 'samuel''@'192.168.%' identified by 'somepassword';
flush privileges;
exit

Then use that user and password in Workbench.
0
 

Author Comment

by:samueldjohnson
ID: 35046626
Hi guys,

Thanks for this advice, but it unfortunately doesn't seem to have worked.  I've done the following:
1. edited etc\mysql\my.cnf to change bind-address from 127.0.0.1 to 0.0.0.0;
2. restarted MySQL service
3. in MySQL: grant all on *.* to 'root'@'%' identified by '[password]'
4. flushed privileges

When I attempt to setup a new connection to hostname: 192.168.44.1 (the ip address of the VMnet1 network adapter) on port 3306, I still get the same error: "Can't get hostname for your address"!!!

Grateful for any help, this is driving me mad!

Cheers, Sam.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 4

Expert Comment

by:Tomun
ID: 35047057
Try adding skip-name-resolve to the my.cnf file, it seems there's a bug in mysql 5.5
0
 

Author Comment

by:samueldjohnson
ID: 35048260
Hi Tomun,

Sorry, should have noted that I've already also tried that (after reading a couple of online forums), but also didn't work.  I now can't even connect to the application via the VM host's browser, so am wondering if something else is in fact going on...
0
 
LVL 4

Expert Comment

by:Tomun
ID: 35054253
Is that because you set a new password for mysql's root user? Does the app give an error message?
0
 

Author Closing Comment

by:samueldjohnson
ID: 35060106
My bad: I was using the wrong VM IP address!  (It's obviously dynamic, and had shifted.)  As soon as I used the correct one, everything worked like a dream - and now also have easy ODBC access in order to make some configuration changes.

Points shared, but the majority to Tomun, as he gave the necessary detail for a beginner to be able to resolve this issue.

Many thanks!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Last article we focus in how to VMware: How to create and use VMs TAGs – Part 1 so before follow this article and perform the next tasks, you should read the first article how to create the TAG before using them in Veeam Backup Jobs.
HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
Teach the user how to rename, unmount, delete and upgrade VMFS datastores. Open vSphere Web Client: Rename VMFS and NFS datastores: Upgrade VMFS-3 volume to VMFS-5: Unmount VMFS datastore: Delete a VMFS datastore:
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now