Link to home
Start Free TrialLog in
Avatar of peter_coop
peter_coopFlag for United Kingdom of Great Britain and Northern Ireland

asked on

mysql refusing network connection

I am trying us ems as a frontend to administer my databases's. However, I have tried as a host: IP, DOMAIN, TUNNELING, SSH TUNNELING, HTTP TUNNELING, but all I keep getting is 'network is refusing your connection (10061). I think I may have found out why but am not experienced enough to make the changes.

I have included values for mysql from my php info file below:

mysql.default_host	no value	no value
mysql.default_password	no value	no value
mysql.default_port	no value	no value
mysql.default_socket	/var/lib/mysql/mysql.sock	/var/lib/mysql/mysql.sock
mysql.default_user	no value	no value
mysql.max_links	Unlimited	Unlimited

Open in new window


I would be grateful if someone could cast an eye over this code and inform me if that is the reason for the non connection.

Many thanks
Avatar of blueeyedsoul
blueeyedsoul

mysql> GRANT ALL ON foo.* TO bar@'10.10.10.10' IDENTIFIED BY 'PASSWORD';

You can be more restrictive than "ALL". You can review the syntax here: http://dev.mysql.com/doc/refman/5.1/en/grant.html

You can wildcard the username (bar) by using a percentage sign.
The error is due to the host restriction to access your DB... Allow the database to access from your host(your IP) or any host(%).. If you are accessing from localhost add localhost in your DB's host
Avatar of peter_coop

ASKER

sorry for delay but internet was down. I have updated the mysql user table from localhost to % but still no difference. Someone suggested it may be the ip tables that are causing it? I have checked the firewall in control panel and mysql is allowed to accept all incoming connections. Is ip tables the same as firewall? thanks
Silly question, but can you connect to MySQL from the local machine?
yes, I can. seems to be only remote network access. thanks
can you telnet to the MySQL server on port 3306? This will determine if it is a firewall/IPTables issue
here is telnet info. Could not open connection to the host, on port 3306. connect failed.
here is the result of issuing netstat -tan|grep 3306


tcp        0      0 127.0.0.1:3306              0.0.0.0:*                   LISTEN   

Open in new window

What flavor of Linux is MySQL installed on?
hi. blinking internet down again. it is CentOS 6 with Parallels Plesk Panel 10 (64-bit)
. Thanks
Try running the following commands as the root user:

/etc/init.d/iptables save
/etc/init.d/iptables stop

If you can connect to MySQL then we know it's firewall related. Then we can either disable IPTables all together or create a rule to allow 3306
Sorry for the length of time taken to respond. Virgin have only just restored the internet after network outage. I have tried your suggestion and still cannot connect. So no way forward there. Thanks
Whoops, I forgot to mention flush privileges. Try the following again:

mysql> use mysql

mysql> GRANT ALL ON *.* to USER_NAME@'%' IDENTIFIED BY 'your-root-password';

mysql> FLUSH PRIVILEGES;
@blueeyedsoul

Can I do this from myphpadmin? I have already granted all privileges in plesk. does this make a difference? also, i have a mysql user name with password. do i use that or the root password above. thanks
I would take the abstraction layer out and do it directly through MySQL. If the mysql user account has admin privileges then that should be all you need to grant privileges.
thanks. I shall try and report back.
ok. Still the same problem. Here is what i did:

/etc/init.d/iptables save
/etc/init.d/iptables stop

mysql> use mysql

mysql> GRANT ALL ON *.* to MY_USER_NAME@'%'IDENTIFIED BY 'MY_PASSWORD'; 

mysql> FLUSH PRIVILEGES;

Open in new window


I have checked my.cnf and there is no option for skip networking. I have included my.cnf to see if anything is wrong there.

[mysqld]
bind-address=127.0.0.1
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Open in new window


Thanks
I think your issue is that your binding MySQL to the loopback adapter:

bind-address=127.0.0.1

Change that address to whatever the local ip address of the physical NIC is (you can determine this running ifconfig at a command shell) and restart MySQL
I have run ifconfig and here is what was returned. What address do I need to insert in the bind-address?

eth0      Link encap:Ethernet  HWaddr 00:16:3E:01:A4:84  
          inet addr:87.106.62.161  Bcast:87.106.62.161  Mask:255.255.255.255
          inet6 addr: fe80::216:3eff:fe01:a484/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:334696 errors:0 dropped:0 overruns:0 frame:0
          TX packets:321195 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:47901901 (45.6 MiB)  TX bytes:129203135 (123.2 MiB)
          Interrupt:8 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:28035 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28035 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:17464162 (16.6 MiB)  TX bytes:17464162 (16.6 MiB)

Open in new window


Thanks
ASKER CERTIFIED SOLUTION
Avatar of blueeyedsoul
blueeyedsoul

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry for the delay. Thank you very much.