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

XAMPP运行故障:端口修改后root用户无密码访问被拒

Fixing phpMyAdmin "Access Denied for 'root'@'localhost' (using password: NO)" with XAMPP After MySQL Workbench Install

Hey there, let's work through this issue together. It sounds like MySQL Workbench might have altered your root user credentials or there's a mismatch between XAMPP's MySQL configuration and phpMyAdmin's settings. Here are actionable steps to resolve this:

1. Verify phpMyAdmin's Configuration

First, make sure phpMyAdmin is pointing to the correct port and using the right root credentials:

  • Navigate to your XAMPP phpMyAdmin config file:
    • Windows: C:\xampp\phpMyAdmin\config.inc.php
    • macOS/Linux: /opt/lampp/phpmyadmin/config.inc.php
  • Open the file in a text editor and check these lines:
    $cfg['Servers'][$i]['port'] = '3307'; // Make sure this matches your XAMPP MySQL port
    $cfg['Servers'][$i]['password'] = ''; // Leave empty since you never set a password
    $cfg['Servers'][$i]['auth_type'] = 'config'; // Skips login prompt and uses the above credentials
    
  • Save the file and restart your XAMPP MySQL and Apache services.

2. Check MySQL Root User Credentials Directly

If phpMyAdmin still errors out, let's confirm the root user's password status via the command line:

  • Open the XAMPP Control Panel, click "Shell" under MySQL.
  • Run this command to connect to your 3307-port MySQL instance:
    mysql -u root -P 3307
    
    • If you connect successfully, the root password is indeed empty—so the issue is likely with phpMyAdmin's config.
    • If you get a password prompt, MySQL Workbench did set a root password. To reset it:
      1. Stop the XAMPP MySQL service from the control panel.
      2. In the XAMPP Shell, run:
        mysqld --skip-grant-tables
        
      3. Open a new XAMPP Shell window and connect with:
        mysql -u root -P 3307
        
      4. Run these commands to reset the root password to empty:
        USE mysql;
        -- For MySQL 8.0+
        UPDATE user SET authentication_string='' WHERE User='root' AND Host='localhost';
        -- For older MySQL versions
        -- UPDATE user SET password=PASSWORD('') WHERE User='root' AND Host='localhost';
        FLUSH PRIVILEGES;
        EXIT;
        
      5. Close the first shell window (running --skip-grant-tables), restart XAMPP MySQL, and try phpMyAdmin again.

3. Clean Up MySQL Workbench Residues (If Needed)

If you suspect lingering Workbench settings are causing issues:

  • Uninstall MySQL Workbench via your system's app manager (Control Panel on Windows, Applications folder on macOS, package manager on Linux).
  • Delete Workbench's configuration folders to remove any leftover settings:
    • Windows: C:\Users\[YourUsername]\AppData\Roaming\MySQL\Workbench
    • macOS: ~/Library/Application Support/MySQL/Workbench
    • Linux: ~/.mysql/workbench
  • Restart your computer, then launch XAMPP and test phpMyAdmin again.

4. Ensure No Other MySQL Processes Are Running

Sometimes, a separate MySQL instance (from Workbench) might interfere. Check for running mysqld processes:

  • Windows: Open Task Manager → Details tab, look for mysqld.exe and end any that aren't part of XAMPP.
  • macOS/Linux: Run ps aux | grep mysqld in the terminal, then kill any unrelated processes with kill [PID].

Let me know if any of these steps resolve your issue, or if you hit any snags along the way!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 08:42:16