Page 1 of 1
Cannot connect remote database mysql from hosting
Posted: Fri Feb 13, 2015 6:47 pm
by madip
Hi,
the problem is always the same.
I cannot connect hosting php web site on my mysql vesta vps.
From command line i can connect without any problem and from many location.
Mysql log error doesn't trace any error.
I set bind address to my external ip but nothing.
I stopped iptables and fail2ban.
The strange behavior is the for some minute i see website working but then ,after a while, always same message:
Can't connect to MySQL server on 'ip address'
On the other vps (without vesta) i can connect without any problem......(same OS , same mysql version, apache,php etc)
Please give me a solution
thanks
Re: Cannot connect remote database mysql from hosting
Posted: Sat Feb 14, 2015 5:31 pm
by skurudo
Oh, it's Vesta fault again? ;)
There is simple solution:
[*] firewall of the server must be set-up to enable incomming connections on port 3306
[*] you must have a user in MySQL who is allowed to connect from % (any host) (see
manualfor details)
More detailed thread -
http://stackoverflow.com/questions/1935 ... -using-php
Re: Cannot connect remote database mysql from hosting
Posted: Sun Feb 15, 2015 9:50 am
by madip
[*] firewall of the server must be set-up to enable incomming connections on port 3306
firewall is set correctly
[*] you must have a user in MySQL who is allowed to connect from % (any host) (see manualfor details)
already done.
For a while connection was up. Then after some minutes was down again!
Client error is : SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'ip' (4)
the error code (4) means interrupted system call.
From the remote command line I can make connection and querying wihout problem.
Very strange problem!
Moreover with tcdump i see incoming / outgoing connection:
Code: Select all
10:52:38.688313 IP remoteserver.53428 >localvps.mysql: Flags [S], seq 2938696093, win 14600, options [mss 1460,sackOK,TS val 1253572476 ecr 0,nop,wscale 7], length 0
10:52:38.688363 IP localvps.mysql > remoteserver.53428: Flags [S.], seq 2585169861, ack 2938696094, win 14480, options [mss 1460,sackOK,TS val 21884416 ecr 1253572476,nop,wscale 7], length 0
In outogoing conn ack value is very high!!
Re: Cannot connect remote database mysql from hosting
Posted: Sun Feb 15, 2015 4:52 pm
by skurudo
Then problem may be in php.ini
max_execution_time
mysql.connect_timeout
And php limitations.
[SOLVED ]Re: Cannot connect remote database mysql from hosti
Posted: Tue Feb 17, 2015 7:20 pm
by madip
Hosting doesn't allow connection to external database.
So it's not vesta problem. Hosting limitation.
thanks
Re: Cannot connect remote database mysql from hosting
Posted: Tue Feb 17, 2015 7:22 pm
by skurudo
Expected unexpected ;-)
Thanks for answer.