user3762774
user3762774

Reputation: 3

Xampp Linux: PDOException: SQLSTATE[HY000] [2002] Connection refused in lock_may_be_available() error

I have been struggling to find a solution for this issue with MySQL. Things changed after I placed a ojdbc jar file on Apache Solr tomcat server. Since then i have been getting this error. It seems there is yet another mysql instance running on the machine. Xampp Status shows MySQL Database is deactivated. I have been searching for a working solution since this morning but no luck. Your help is very much appreciated.

PS: /opt/lampp/lampp status says mysql is 'running'. When stopped, it reads 'OK' but when starting it again, it says 'already running'....and the Xampp Status page says MySQL database is Deactivated

Upvotes: 0

Views: 2613

Answers (1)

Jatin Chaudhary
Jatin Chaudhary

Reputation: 176

The command /opt/lampp/lampp status basically goes and check for the pid file MYSQL_PIDFILE=/opt/lampp/var/mysql/$HOSTNAME.pid

Sometimes this PID file get corrupted (in case of a crash, or procees kill).

In such scenario, the status command will tell you that the mysql is running, where as there is no process that exists for that PID file and the XAMPP status which shows in the browser will not be able to connect to the server (because it is not running) and hence come as deactivated.

Just rename the pid file as $HOSTNAME_bkp.pid or something like that and restart lampp, the issue will get resolved.

Upvotes: 2

Related Questions