Quantcast
Channel: simply felice » Tech (EN) | simply felice
Viewing all articles
Browse latest Browse all 8

Plesk on CentOS: ERROR: PleskFatalException: Unable to connect to database: mysql_connect(): Connection refused

$
0
0

This error most likely occurs when the server was hard resetted and the MySQL socket still exists. If you are now wondering because you haven’t touched your machine at all, you might be on a shared host. This is the case when you rented a Virtual Private Server (VPS) or Cloud Server (which is more or less the same) or anything similar where you have root access often included with PLESK or Confixx but you actually don’t have a real machine (dedicated server).

Although you have full control of your virtual machine you still do NOT control the real hardware behind! Once the machine your virtual sits on goes down it’s like pulling the plug for your VPS / Cloud Server.

I’ve experienced this scenario now for a few times on Cloud Servers with CentOS 6. All MySQL on this machine (including PLESK panel) stopped working. Thankfully I’ve found a nice fix on the following page (German only!):

http://adminforge.de/control-panel/plesk/plesk-unable-connect-database-mysql_connect-connection-refused-auth-php142/

Maybe a translator of your choice will help you out; but here’s briefly what the fix is about:

You basically have two choices. I wouldn’t suggest to use the temporary one (first one) at all as the underlying problem is likely to occur again in the future, especially on virtual machines like explained above!

I’d recommend to stop MySQL at first by

# /etc/init.d/mysqld stop

Then go ahead and edit start() function in /etc/init.d/mysqld by finding the line

if [ -S "$socketfile" ] ; then

which is normally in or somewhere around line 118. Replace the whole if down to the next fi with the following new version:

if [[ -S "$socketfile" && -f "$mypidfile"  ]] ; then
  echo "Another MySQL daemon already running with the same unix socket."
  action $"Starting $prog: " /bin/false
  return 1
else
  echo "Remove $socketfile"
  rm -f "$socketfile"
fi

Finally safe the file and restart MySQL by

# /etc/init.d/mysqld start

If you did the fix correctly and did NOT use the temporary fix at first, you will now see MySQL starting correctly including a promt saying „Remove $socketfile“.


Viewing all articles
Browse latest Browse all 8

Trending Articles