Cannot establish an external MySQL connection to the server.
Error 1. Error 10061: connect to MySQL server failed
Fixed it using the following solution (https://help.ubuntu.com/community/ApacheMySQLPHP)
Solution 1.
Set mysql bind address
Before you can access the database from other computers in your network, you have to change its bind address. Note that this can be a security problem, because your database can be accessed by other computers than your own. Skip this step if the applications which require mysql are running on the same machine.
type:
$ sudo nano /etc/mysql/my.cnf
and change the line:
bind-address = localhost
to your own internal ip address e.g. 192.168.1.20
bind-address = 192.168.1.20
If your ip address is dynamic you can also comment out the bind-address line and it will default to your current ip.
If you try to connect without changing the bind-address you will recieve a "Can not connect to mysql error 10061".
Error 2. Host 'DELL-I660s' is not allowed to connect to this MySQL server
Solution 2:
(https://www.thegeekstuff.com/2010/08/allow-mysql-client-connection/)
Notes: It is weird that I have to authorize all the IPs from which I will be conecting to the MySQL Database.
$ mysql -h 192.168.1.8 -u root -p
Enter password: ERROR 1130: Host '192.168.1.4' is not allowed to connect to this MySQL server
You can also validate this by doing telnet to 3306 mysql port as shown below, which will also give the same “host is not allowed to connect to this mysql server” error message as shown below.
$ telnet 192.168.1.8 3306 host 192.168.1.4 is not allowed to connect to this mysql server
If you want to allow a specific client ip-address (for example: 192.168.1.4) to access the mysql database running on a server, you should execute the following command on the server that is running the mysql database.
$ mysql -u root -p Enter password: mysql> use mysql mysql> GRANT ALL ON *.* to root@'192.168.1.4' IDENTIFIED BY 'your-root-password'; mysql> FLUSH PRIVILEGES;