Xampp Linux:PDOException:SQLSTATE [HY000] [2002]连接在lock_may_be_available()中被拒绝错误

时间:2022-10-14 13:49:30

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.

我一直在努力为MySQL找到这个问题的解决方案。在Apache Solr tomcat服务器上放置ojdbc jar文件后,事情发生了变化。从那时起,我一直在收到这个错误。似乎机器上还有另一个mysql实例在运行。 Xampp状态显示MySQL数据库已停用。我从今天早上起一直在寻找一个有效的解决方案,但没有运气。非常感激你的帮助。

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

PS:/ opt / lampp / lampp status表示mysql正在“运行”。当停止时,它会显示“OK”,但在再次启动时,它会显示“已经运行”....并且Xampp Status页面显示MySQL数据库已停用

1 个解决方案

#1


1  

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

命令/ opt / lampp / lampp status基本上是检查pid文件MYSQL_PIDFILE = / opt / lampp / var / mysql / $ HOSTNAME.pid

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

有时这个PID文件被破坏(如果发生崩溃,或者进行杀戮)。

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.

在这种情况下,status命令将告诉您mysql正在运行,因为该PID文件没有进程,并且浏览器中显示的XAMPP状态将无法连接到服务器(因为它是没有运行)因此停用了。

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

只需将pid文件重命名为$ HOSTNAME_bkp.pid或类似的东西并重启lampp,问题就会得到解决。

#1


1  

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

命令/ opt / lampp / lampp status基本上是检查pid文件MYSQL_PIDFILE = / opt / lampp / var / mysql / $ HOSTNAME.pid

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

有时这个PID文件被破坏(如果发生崩溃,或者进行杀戮)。

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.

在这种情况下,status命令将告诉您mysql正在运行,因为该PID文件没有进程,并且浏览器中显示的XAMPP状态将无法连接到服务器(因为它是没有运行)因此停用了。

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

只需将pid文件重命名为$ HOSTNAME_bkp.pid或类似的东西并重启lampp,问题就会得到解决。