1

I wanna Access the MySQL Database founded in Windows 10 from VMware Workstation MAC OS X guest and give the guest ( MAC in VMware ) only permissions to just one database from the host (Windows 10),

I mean I want the Mac guest can access to one database from the host (NOT For ALL Databases).

I am connected in the guest by bridge network adapter. I know I must do a change in /Applications/XAMPP/xamppfiles/etc/my.cnf but don't know what. ( I am using XAMPP 7.1.6, it's doesn't have bind_address ).

I want the database always up in my machine ( Windows 10 ) and when I run the VMware mac guest ( MAC ) so the guest can access to this database.

( I mean I want the database to be accessed in the host ( although when VMware is off ) .

I have already made a database in PhpMyAdmin in the host ( Windows 10 ), How can I access to just this database from the MAC guest in the VMware.

I wanna mention I don't want to give permissions to this database to another computers in my Network, or another computers that have my IP Address.

I appreciate any help. Thanks.

1 Answer 1

1

You have to comment out the single line in the `my.cnf:

 bind_address = 127.0.0.1

By default mysql server listen only on the localhost for security reason. When that line is commented, mysql server become listening on the all available interfaces because default value is bind_address = *. Now you can connect to the mysql from the host OS by IP-address of the VM.

To restrict guest access to the single database/schema you have to perform the next query:

GRANT ALL PRIVILEGES ON database.* 
   TO 'guestuser'@'1.2.3.4' 
   IDENTIFIED BY 'somepassword';

where 1.2.3.4 is an IP-address of your host OS.

If you have dynamically assigned IPs on your LAN then you have to allow connections from the whole subnet your IPs are belongs to:

GRANT ALL PRIVILEGES ON database.* 
   TO 'guestuser'@'192.168.%' 
   IDENTIFIED BY 'somepassword';

where 192.168.% means 192.168.0.0-192.168.255.255

3
  • If you have used bridged interface for VM then it has an IP assigned by DHCP server on the LAN the same way your host OS has. Run cmd command in the windows then run ipconfig command in it. guestuser is just a placeholder for the login name used for connections to the mysql server. Replace it to the arbitrary name you want.
    – Kondybas
    Commented Jul 3, 2017 at 21:05
  • Thank you for your reply, I don't have a bind_address line in the my.cnf, in my [mysqld] I have user, port, socket.. and more. Another thing what is the guestuser ? what is this user name mean ? And what about the ip, my lan ip isn't static what can I do for that ?,how I can make the ip for the VMware static ? FYI I have XAMPP 7.1.6 Thanks Commented Jul 3, 2017 at 21:06
  • Thank you al lot man. Can you please edit your solution and be more specific and tell me in steps what to do. step 1 - is to make the network adapter in the VMware bridged. step 2 - run ifconfig in the OS X ( guest ) step 3 - run this command in PHPMYADMIN in WINDOWS 10 ( The Host ) and choose the database name I want to share and choose the LAN IP for the guest OS X and then what to do ? Commented Jul 3, 2017 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.