I have noticed a pretty significant number of people having trouble with MySQL connections in a number of different ways. Usually, the message is: ERROR 2003.
This problem can have a few causes. However, let me contribute this. It is important to go to the file called /etc/mysql/my.cnf and find the line “bind-address = 127.0.0.1.” Comment this line out. This will allow MySQL to listen for remote attempts to connect to the database.
I hope this helps if you stumble on this while looking for help. Good luck. Please note: your my.cnf file could be in a different directory depending on which distribution you are using. If you are using Xampp, you will find it in /opt/lampp/etc.