Lost connection to MySQL server at 'waiting for initial communication packet'

14,800

Found a reason - answering my question:

When I used to run MySQL from my application - it was running under system user privileges - so it used to pick "C:\WINDOWS\TEMP" as a temp directory- this directory was messed up - has lot of unnecessary files .. and MySQL was stuck while processing files under this directory...

But when I ran it manually under My administrator account it was using his temp directory... C:\Users\USER_NAME\AppData\Local\Temp and everything was working like magic...

To fix this permanently I changed tmp directory through MySQL conf file and now My Application runs like the Wind.... :)

[mysqld]
tmpdir = 'PATH_TO_THE_DIRECTORY'
Share:
14,800
Samurai
Author by

Samurai

I am a Open Source developer, main work areas are Database internals and Unix (Linux) For more details: http://in.linkedin.com/in/samratrevagade

Updated on June 11, 2022

Comments

  • Samurai
    Samurai almost 2 years

    I have seen many stack overflows questions and some blogs tried workarounds, but nothings helped - hence re-posting the question with more details.

    I am seeing the weird behaviour with MySQL and Python application, details are as follows:

    1) My application works perfectly fine with MySQL (tried and tested on many platforms) but on this particular machine it fails to connect to MySQL.

    structure of application is :

       Windows service -> parent process -> Mysql(child process)
    

    and when application tries to connect to MySQL it get this error:

    ERROR 2013 , Lost connection to MySQL server at 'waiting for initial communication packet' - system error 0
    

    I tried:

    - connect_timeout=300
    - skip-name-resolve=0
    - firewall is OFF
    - use 17.0.0.1, localhost , IP of machine to connect to but it still fails with same error.
    

    2) Now the weird thing is -

    If I manually follow all the steps which application does, It works perfectly fine, details are follows: a) Start MySQL with same command (which application uses) with administrator privileges

    mysql --default-file = xxx --basedir =xxx
    

    b) Connect with same credentials ( -u root -P 6075 -h 127.0.0.1) and It works perfectly fine, I double checked all the steps which application does, there is no difference between manually steps and application code.

    AM I missing something here ? Any suggestions ?

    MySQL version : 5.5.35
    Python : 2.7
    Base OS : Windows 2012 R2 
    

    Thanks in advance..