https://stackoverflow.com/questions/5755819/lost-connection-to-mysql-server-at-reading-initial-communication-packet-syste 1) Allow remote connect to MySQL. Edit file: > sudo nano / etc / mysql / my . cnf Comment line: #bind-address = 127.0.0.1 Restart MySQL: > sudo service mysql restart 2) Create user for remote connection. > mysql - uroot - p CREATE USER 'developer' @ 'localhost' IDENTIFIED BY 'dev_password' ; CREATE USER 'developer' @ '%' IDENTIFIED BY 'dev_password' ; GRANT ALL ON *.* TO 'developer' @ 'localhost' ; GRANT ALL ON *.* TO 'developer' @ '%' ; 3) In my case I need to connect remotely from Windows to VirtualBox machine with Ubuntu. So I need to allow port 3306 in iptables: > iptables - A INPUT - i eth0 - p tcp - m tcp -- dport 3306 - j ACCEPT share improve this answer follow