xampp 无法使用 phpmyadmin(mysql 错误)

xampp cannont use phpmyadmin ( mysql error )

我刚刚在我的 manjaro(一个 archlinux 发行版)上安装了 xampp,但我无法使用 phpmyadmin,因为 mysql 似乎没有响应。
当我使用 sudo xampp start 时,输出如下:

XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

但是当尝试使用 sudo xampp restart 重新启动它时,它显示:

XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...not running.
XAMPP: Stopping ProFTPD...ok.
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

当连接到 http://localhost/phpmyadmin/ 时显示欢迎,但我确实按顺序显示 4 个错误:

\#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

经过研究,我确实注意到我缺少 /opt/lampp/var/mysql/mysql.sock 文件,但我不知道如何创建和配置它。

我也尝试使用 mysqld,正如在一些教程中看到的那样,但出现了这些错误:

2017-04-14 12:41:29 140391574202432 [Note] mysqld (mysqld 10.1.22-MariaDB) starting as process 4483 ...
2017-04-14 12:41:29 140391574202432 [ERROR] mysqld: File './mysql-bin.index' not found (Errcode: 13 "Permission denied")
2017-04-14 12:41:29 140391574202432 [ERROR] Aborting

听起来您需要检查本地套接字配置。这是在 /etc/mysql/my.cnf 中配置的,应该如下所示:

[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

打开 phpMyAdmin 配置文件 (config.inc.php) 并更改套接字地址。也许您的 phpMyAdmin 上没有本地套接字配置,或者可能有所不同。此文件应包含一行(当然,请根据您在 my.cnf 上找到的内容调整地址):

$cfg['Servers'][$i]['socket'] = '/var/run/mysqld/mysqld.sock';

重置 MySQL 根密码。

问题将消失。 好时机。

修复 MySQL 数据库在 mac 中不是 运行。 在 Applications/XAMPP/etc/my.cnf

中打开 my.cnf 文件

然后把MySQL端口号3306改成3308

     # The MySQL server
     [mysqld]
     user = mysql   
     port= 3308     
     socket= /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock

然后重新启动服务器