2

I am trying to access the remote database from one Linux server to another which is connected via LAN.

but it is not working.. after some time it will generate an error

`_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '192.168.0.101' (99)")'

this error is random it will raise any time. each time create a new db object in all methods. and close the connection as well then also why this error raise. can any one please help me to sort out this problem

VasaraBharat
  • 81
  • 15
  • Add nonroot user to sql >>> Create A table and give to related user (or share any table) . Read this http://stackoverflow.com/questions/16287559/mysql-adding-user-for-remote-access – dsgdfg Jul 27 '15 at 04:59
  • thanks, but this will not an acceptable solution for me. i don't have permissions to create a new users or to transfer database from remote server to local server. – VasaraBharat Jul 27 '15 at 05:58
  • can `time.sleep(sec)` help me? – VasaraBharat Jul 27 '15 at 05:59
  • Dump server data to another server(clone). Or you need send a permission request to system administrators... You are got a Administrative permission on your networks ? – dsgdfg Jul 27 '15 at 07:54

2 Answers2

0

This issue is due to so many pending request on the remote database.

So in this situation MySql closes the connection to the running script.

to overcome this situation put

time.sleep(sec) # here int is a seconds in number that to sleep the script.

it will solve this issue.. without transferring database to local server or any other administrative task on mysql

VasaraBharat
  • 81
  • 15
-3

My solution was to collect more queries for one commit statement if those were insert queries.

dori333
  • 1
  • 1
  • 2
    Could you provide a bit more detail on your solution? – Mike P Jan 18 '17 at 17:19
  • Sorry, for not answering, I haven't seen that comment, but maybe someone will benefit from that, even though... It is not elegant way, but none of the posted solutions in this and related topics worked for me. I was selecting and inserting milions of rows one by one while comperating exisiting data at some level and transfering new data to database. Well, as there were too many pending request, I've collected as many execute statements in one connection and commit them at once. That was the solution for python-mysql communication. – dori333 Jul 03 '17 at 06:42