Advertisement:

Author Topic: Can't connect to local MYSQL server through socket  (Read 1478 times)

Offline f00ty

  • Jr. Member
  • **
  • Posts: 110
Can't connect to local MYSQL server through socket
« on: May 28, 2014, 12:53:11 AM »
Hi,

I get about 10-20 messages a day to my error log:
Quote
2: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (11)

File: /home/www/mysite/Themes/mytemplate/index.template.php
Row: 328

It happens randomly to users, and to me also sometimes. Because of this, some of the messages won't be sent etc. How to correct this issue? Notice that this doesn't happen all the time, it happens randomly.
« Last Edit: May 28, 2014, 02:10:59 PM by f00ty »

kat

  • Guest
Re: Can't connect to local MYSQL server through socket
« Reply #1 on: May 28, 2014, 06:23:59 AM »
Best I can offer, at this stage, is for you to check the MySQL log, to see if the server's actually running and/or if it's crashed/isn't ready to accept connections for whatever reason(s).

Probably one for your host...?

Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Can't connect to local MYSQL server through socket
« Reply #2 on: May 28, 2014, 12:50:07 PM »
Question. Why are you trying to connect to the database in a template file? That should never happen (and that code is certainly not in a default installation of SMF).
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline f00ty

  • Jr. Member
  • **
  • Posts: 110
Re: Can't connect to local MYSQL server through socket
« Reply #3 on: May 28, 2014, 02:02:32 PM »
Unfortunately I don't have an option to view MySQL logs (shared hosting).

Woops, it's my custom (******ty) code. My apologies.