我有一台在线服务器(Ubuntu),上面安装了 xampp。然后安装了 WordPress,已经快 7 个月了,一切都很顺利。以前,当我在 WordPress 上更新一些帖子或添加更多帖子标签时,phpmyadmin 就会崩溃,所以我每次都重新启动 xampp,一切正常。
但是昨天当我在 WordPress 上更新帖子时,phpmyadmin 又崩溃了,但这次我重新启动了 xampp
当我启动 xampp 时它说
ubuntu@ip-xxx-xx-xx-xxx:$ sudo /opt/lampp/lampp start
Starting XAMPP for Linux 7.0.23-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
但什么也没发生我的 WordPress 网站说“建立数据库连接时出错“当我访问 mysite.com/phpmyadmin 并输入我的 phpmyadmin 用户名和密码时,它显示:
#2002 - No such file or directory — The server is not responding (or the local server's socket is not correctly configured).
mysqli_real_connect(): (HY000/2002): No such file or directory
Connection for controluser as defined in your configuration failed.
mysqli_real_connect(): (HY000/2002): No such file or directory
四个错误同时出现。我的xampp安装目录是/opt/lampp
我尝试在 phpmyadmin 的 config.inc.php 中添加此行,但没有任何反应
$cfg['Servers'][$i]['host'] = 'localhost';
或者
$cfg['Servers'][$i]['host'] = '127.0.0.1';
我还检查了 /opt/lampp/etc/my.cnf 它的套接字位置为 socket = /opt/lampp/var/mysql/mysql.sock 但是我在此路径上找不到任何 mysql.sock 我也搜索了 sudo find / -type s 但没有找到 mysql.sock
错误日志:
configured -- resuming normal operations
[Thu Jul 11 22:46:36.013239 2019] [core:notice] [pid 4713] AH00094: Command line: '/opt/lampp/bin/httpd -E /opt/lampp/logs/error_log -D SSL -D PHP'
[Thu Jul 11 23:01:37.602242 2019] [mpm_prefork:notice] [pid 4713] AH00169: caught SIGTERM, shutting down
[Thu Jul 11 23:09:42.001635 2019] [ssl:warn] [pid 5286] AH01906: www.example.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Jul 11 23:09:42.001719 2019] [ssl:warn] [pid 5286] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jul 11 23:09:43.001695 2019] [ssl:warn] [pid 5287] AH01906: www.example.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Jul 11 23:09:43.001753 2019] [ssl:warn] [pid 5287] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jul 11 23:09:43.001843 2019] [lbmethod_heartbeat:notice] [pid 5287] AH02282: No slotmem from mod_heartmonitor
[Thu Jul 11 23:09:43.012733 2019] [mpm_prefork:notice] [pid 5287] AH00163: Apache/2.4.27 (Unix) OpenSSL/1.0.2l PHP/7.0.23 mod_perl/2.0.8-dev Perl/v5.16.3 configured -- resuming normal operations
[Thu Jul 11 23:09:43.012781 2019] [core:notice] [pid 5287] AH00094: Command line: '/opt/lampp/bin/httpd -E /opt/lampp/logs/error_log -D SSL -D PHP'
[Thu Jul 11 23:10:29.074354 2019] [mpm_prefork:notice] [pid 5287] AH00169: caught SIGTERM, shutting down
当我通过以下方式更改 /opt/lampp 的权限时,还有一次更新
sudo chmod -R 777 /opt/lampp
执行此行后,一切正常,phpmyadmin 没有给出任何错误,但这个权限不安全,我认为文件权限有问题......
这个问题的解决方案是什么,请指导我,谢谢...