How to access the database of another machine

-1
Well, guys, good night. The following is: I'm having a PHP project with MySQL to be delivered. However, I'm doing it this way: I created 3 virtual machines in VMWare Workstation Pro, Client's is Windows, which only stays PHP is Ubuntu, and the one that stays in the database is also Ubuntu. The idea is to be a simulation. From the Client machine, I can access the site on the PHP machine through machine IP / filename.php, I can do this without problems. The business is that I made a form on this PHP site to insert data into the database that is on another machine. Opera Summary: I can not get a connection to the database, that is, I can not get remote access to the database, even though I have configured the connection file in the right way. I have already researched in several places, both national and in the gringa, and found nothing. If you can help me, I'll be very grateful !!!!!!

    
asked by anonymous 10.12.2017 / 23:43

2 answers

0

To allow external access to the mysql database on a remote server, it is to configure it for external access.

  • Access the my.cnf file and modify the IP bind-address = 127.0.0.1 parameter to 0.0.0.0
  • Restarting mysql
  • Access mysql from within the server and give the access permissions from any IP. mysql > GRANT ALL ON . TO 'root' @ '%' IDENTIFIED BY '[password]' WITH GRANT OPTION;
  • To finish updating the privileges mysql > FLUSH PRIVILEGES;
  • 11.12.2017 / 00:25
    0

    Can you connect to MySQL from your own host? If not, see if it is running.

    sudo service mysql status
    

    If the status is as 'active', make sure the /etc/mysql/my.cnf file contains the bind-address line 127.0.0.1. If so, comment on it with # or remove it.

    Also check that your firewall is active:

    sudo ufw status verbose
    

    If it is, it may be necessary to unlock port 3306 - or one set as default.

    sudo ufw allow from 192.168.* to any port 3306
    

    I hope I have helped! Thanks!

        
    11.12.2017 / 00:34