Error: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (111) on database: sphinx

Issue #208 resolved
Ronald Top created an issue

Hi J. Suto,

All is now installed without any errors, but when I borwse to my site I get this error. The database does indeed not exist. In the config.php I see the following entries:

$config['SPHINX_DRIVER'] = 'sphinx'; $config['SPHINX_DATABASE'] = 'sphinx'; $config['SPHINX_HOSTNAME'] = '127.0.0.1:9306'; $config['SPHINX_MAIN_INDEX'] = 'main1'; $config['SPHINX_TAG_INDEX'] = 'tag1'; $config['SPHINX_NOTE_INDEX'] = 'note1';

Are these entries used and if yes, what do I need to change them to?

Thanks!

RTop.

Comments (18)

  1. Ronald Top reporter

    Indeed, sorry, searchd wasn't running, would have sweared it did. Sorry again. You can close this as well! Grtz, RTop

  2. Arunmani Murugan

    Hi jsuto,

    I faced the same issue but in my case searchd wasn't started and no problem in starting rc.piler. so got the same MySQL error. on analyzing i came to know /var/run/piler/search.pid was not updated with id thus caused the issue to resolve I just passed the command searchd --stop and restarted the service. it works fine now..!!

  3. Jahir

    Hi Janos, im facing the same issue and i couldn't able to fix this.

    Error: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (111 "Connection refused") on database: sphinx

    it happen after the linux updates.

  4. Janos SUTO repo owner

    Hello Jahir. Please start the searchd daemon, make sure it's listening on port 9306, and the web server user (perhaps www-data) can access it.

  5. Jahir

    hello Janos, Thanks for your reply. i have changed the listening port 9306. pls find the attached screen shot. is this correct ? also pls let me know how to start searchd daemon. im not familiar in linux.Capture.JPG

  6. Janos SUTO repo owner

    Yes, it seems to be fine. To start searchd, locate and use rc.searchd. It should be right next to rc.piler.

  7. Jahir

    Hi Janos, still the issue remains.

    Error: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (111 "Connection refused") on database: sphinx

  8. Janos SUTO repo owner

    Is searchd running? Can you access it by the following command?

    mysql -h 127.0.0.1 -P9306
    

    Is there any security layer blocking the web server accessing it? (most notably selinux)

  9. Janos SUTO repo owner

    Remove the following from sphinx.conf:

    listen = 127.0.0.1:9306

    Then try starting it again. I didn't spot the error in your config.

  10. Log in to comment