trouble connecting to MySql DB (PHP)

后端 未结 4 1645
故里飘歌
故里飘歌 2021-01-27 12:16

I have the following PHP code to connect to my db:



        
4条回答
  •  自闭症患者
    2021-01-27 12:32

    I also have noticed this issue linux version of xampp with MySSQL 5.6.12-log running over network. Also, a question asked in MySQL forum (http://forums.mysql.com/read.php?52,294772,294772) resembles this, but not satisfactorily answered.

    What I have noticed is, it is probably due to Networking being unstable, or too many mysql connections from other developers in the network connecting to the database server at the same time - and keeping the port number busy for a fraction of time. It is not often related to the configured connection time, nor maximum execution time, nor wrong username/password etc.

    Amazingly, the same script, same password, and same network allows the same server run properly on the second attempt - without having to do anything as a fix.

    Hence, it should be your momentarily unstable network fluctuation (or busy mysql connections), that goes on and off, and your script attempted to connect to the server when network was down for a very short time.

    That is a guessed answer from personal experience related to this error, may not be exact.

    But if the error message is persistent, you should really need to do something.

提交回复
热议问题