2 messages in com.mysql.lists.mysqlRe: Can't connect to MySQL server on ...
FromSent OnAttachments
mt...@digiway.com16 Sep 2000 07:57 
Tonu Samuel16 Sep 2000 09:48 
Subject:Re: Can't connect to MySQL server on 'localhost'
From:Tonu Samuel (to@mysql.com)
Date:09/16/2000 09:48:55 AM
List:com.mysql.lists.mysql

mt@digiway.com wrote:

Description:

After the mysqld has been alive for a while I can't connect to the server in Solaris 2.4/gcc-2.95.2/mysql-3.22.32 environment.

Error message is as follows:

# mysql -p Enter password: ERROR 2003: Can't connect to MySQL server on 'localhost' (146)

How-To-Repeat:

Let the server be without transactions for a while.

Fix:

Restarting the server.

By default MySQL makes connection over unix socket. This special socket file is created somewhere like /tmp/mysql.sock when MySQL starts and prorably some another script deletes this file afterward. If you need to delete files in /tmp directory, you can use /etc/my.cnf file to change location of socket file. For connecting MySQL when socket is lost use:

mysql -p -h127.0.0.1

Note 127.0.0.1 uses TCP connection but "localhost" uses unix socket.