Problem: I have an application in VMWare that needs to connect to MySQL database server in host machine. Both host machine and virtual machine are on the same server. How do I do it?
Solution: refer to the steps below …
- In host machine, one has to create a new MySQL User and assign privileges as below in Query prompt via phpMyAdmin or SQL editor:-
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION; CREATE USER 'username'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;
- Once done with all four queries, the virtual machine should able to connect with IP address, user name and password of database’s host machine, e.g.:-
IP address: 192.168.0.59