You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Linux Endless OS 3下XAMPP phpMyAdmin出现#2002访问拒绝错误

Fixing phpMyAdmin 2002 Error on Endless OS 3 with XAMPP

Hey there, let's get that frustrating phpMyAdmin error sorted out. The "2002 - No such file or directory" message almost always boils down to two issues: either MySQL isn't running, or phpMyAdmin can't locate the MySQL socket file. Here's how to fix it step by step:

1. Check if MySQL is Running in XAMPP

First things first—confirm the MySQL service is active:

  • Open your XAMPP Control Panel (you’ll find it in your Endless OS app launcher). Look for the MySQL module; if its status isn’t Running, click the Start button.
  • If the GUI fails to start MySQL, try the command line:
    1. Open a terminal and navigate to XAMPP’s bin directory:
      cd /opt/lampp/bin/
      
    2. Start MySQL manually:
      sudo ./mysqld_safe &
      
    (You’ll need to enter your Endless OS user password when prompted.)

2. Fix the MySQL Socket Path Mismatch

phpMyAdmin might be looking for the MySQL socket in the wrong location. Let’s correct that:

  • First, find where XAMPP’s MySQL stores its socket file. Run this command in terminal:
    /opt/lampp/bin/mysql_config --socket
    
    You’ll get a path like /opt/lampp/var/mysql/mysql.sock—copy this string.
  • Next, edit phpMyAdmin’s config file with sudo privileges:
    sudo nano /opt/lampp/phpmyadmin/config.inc.php
    
  • Look for the line that says:
    $cfg['Servers'][$i]['socket'] = '';
    
    Replace the empty string with the socket path you copied earlier, so it looks like:
    $cfg['Servers'][$i]['socket'] = '/opt/lampp/var/mysql/mysql.sock';
    
  • Save and exit the editor: press Ctrl+O, hit Enter, then Ctrl+X.

3. Fix Permissions or Corrupted MySQL Files

If MySQL refuses to start, permission issues or corrupted database files might be to blame:

  • Set the correct ownership for MySQL’s data directory:
    sudo chown -R mysql:mysql /opt/lampp/var/mysql/
    
  • Try repairing all MySQL databases to fix potential corruption:
    sudo /opt/lampp/bin/mysqlcheck --all-databases -u root -p
    
    (XAMPP’s default root password is blank—just press Enter when asked for a password.)

4. Restart XAMPP

After making any changes, restart XAMPP to apply them:

  • In the XAMPP Control Panel, click Stop for all running services, then click Start again.
  • Or use the command line:
    sudo /opt/lampp/lampp restart
    

Once you’ve completed these steps, try accessing http://localhost/phpmyadmin again—it should load without the 2002 error.

内容的提问来源于stack exchange,提问作者anand kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:56:13