Connection test php code:
<?php
$link = mysql_connect('****','****','****');
if (!$link) {
die('Could not connect to MySQL: ' . mysql_error());
}
echo 'Connection OK'; mysql_close($link);
?>
Error text:
Could not connect to MySQL: A connection can not be established because the target computer expressly denied the connection.
Note: the error text is translated from other language.
MySql configuration file has bind-address = 127.0.0.1
commented and mysql service is restarted.
select user,host from mysql.user; :
+------------------+-----------+
| user | host |
+------------------+-----------+
| dev0 | % |
| debian-sys-maint | localhost |
| mysql.sys | localhost |
| phpmyadmin | localhost |
| root | localhost |
+------------------+-----------+
I acces with dev0 user
Sudo netstat -plunt:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::3306 :::* LISTEN 15182/mysqld
Iptables:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination