cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

Database remote connection dropped after a few seconds of inactivity

Hi there

I managed to successfully connect to my database in a remote databse session by using the command "mysql -h mydomain.com -uauth_user_name -p'mypasswd' mydatabase_name". I got the mysql prompt and I can issue any command I like. Everything works, except the connection is closed after a few seconds of inactivity.

 

In the other hand, if I remotely connection to a linux session using ssh and then, I connect to the same database this time using 'localhost' as argument to -h option, the connection remains stable, even after several minutes of inactivity.
I need to use it remotely (i mean, -hmydomain.com) because I want to redirect input and output to read/write files on my home machine.  I can't do that (easily) when I am locally (-hlocalhost).

Why the remote connection has a so short logout time out ? How do I increase this time to stay connected for a long (lets say 10 minutes) time of inactivity ?

 

4 REPLIES 4
Super User III
Super User III

Re: Database remote connection dropped after a few seconds of inactivity

@MiguelRoz 

 

Are you on a cPanel or VPS server - based on what I'm reading you can adjust the MySQL timeout / wait time, however you need to be on a VPS server where you can edit the MySQL config file as it's a server level file



I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

Re: Database remote connection dropped after a few seconds of inactivity

I am on cPanel, EconomyHosting plan; SO I guess I can not adjust such parameter.

Do you have a plan VPS Server ?

Do you connect to mysql directly from your computer ? No trouble at all ? 

 

thanks,

 
Super User III
Super User III
Solution

Re: Database remote connection dropped after a few seconds of inactivity

@MiguelRoz 

 

While I do have a number of VPS servers, I typically do not connect from my local machine.

The only times I have, I use the MySQL workbench to run some various queries and I've never had any issues with timeouts.

 

Have you tried the MySQL workbench to see if that might help with your issue vs doing things command line.



I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

Rockstar I Rockstar I
Rockstar I
Solution

Re: Database remote connection dropped after a few seconds of inactivity

Hi @MiguelRoz,

 

@PL281 is spot on!  The smaller, shared servers are not really designed for operations that feed other "local services".  Opening up those data flows can be really server intensive and on occasion be a security issue.  

 

Also note, by using the workbench tool you are developing in an environment that is actually closer to a real world configuration because all of your calls are made to a server that IS designed specifically for that purpose.  I developed in a local environment for a while, kind of liked it.  However, I started running into too many simple problems that could be eliminated by running on a staging server. 

 

Hope this helps,

James

Not Just Pretty Sites, Pretty Doggone Smart Sites