trouble connecting to MySql DB (PHP)

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

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



        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-27 12:38

    Check the following:

    1. Is MySQL running?
    2. Is there any firewall that could be blocking your computer from accepting connections to MySQL on port 3306?
    3. Is MySQL listening on port 3306, or did it get changed to something nonstandard?
    4. An odd one, but try changing from localhost to 127.0.0.1

    Basically, the errors you're getting mean that it cannot connect to the server. It sends request to localhost:3306, and only waits so long for a reply. it's not getting it, which means the request is either blocked (firewall) or ignored (MySQL is not running and/or is listening on a different port)

    If phpMyAdmin came with the MySQL install, then it could be that it was configured to use the appropriately different port

提交回复
热议问题