You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

XAMPP中phpMyAdmin提示Wrong username/password. Access denied无法运行,该如何解决?

Hey, let’s fix that phpMyAdmin login error ("Wrong username/password. Access denied.") in your XAMPP setup step by step—this is a super common issue, and I’ve worked through it dozens of times. Here’s what to try:

1. Start with the default credentials first

XAMPP ships with a default phpMyAdmin setup where the username is root and the password is empty (yes, completely blank!). A lot of people accidentally fill in a password here, so first try logging in with:

  • Username: root
  • Password: (leave this field empty)

If that works, you’re done! If not, move on to the next steps.

2. Check phpMyAdmin’s config file

PhpMyAdmin stores its login settings in the config.inc.php file, located in your XAMPP phpMyAdmin folder (e.g., C:\xampp\phpMyAdmin\config.inc.php on Windows, /Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php on macOS).

Open this file in a text editor and look for these lines:

$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';

Make sure:

  • The user value is root (unless you created a different MySQL user for phpMyAdmin)
  • The password value matches your actual MySQL root password. If you never set a MySQL password, leave this empty.

Save the file, then restart both Apache and MySQL services in the XAMPP control panel. Try logging in again.

3. Reset your MySQL root password if you forgot it

If you can’t remember your MySQL root password, here’s how to reset it:

  1. Stop the MySQL service in the XAMPP control panel.
  2. Open a command prompt (Windows) or terminal (macOS/Linux) and navigate to your XAMPP MySQL bin directory:
    # Windows example
    cd C:\xampp\mysql\bin
    
    # macOS/Linux example
    cd /Applications/XAMPP/xamppfiles/bin
    
  3. Start MySQL with permission checks disabled:
    # Windows
    mysqld.exe --skip-grant-tables
    
    # macOS/Linux
    ./mysqld --skip-grant-tables
    
  4. Leave that window open, and open a new command prompt/terminal. Navigate back to the MySQL bin directory, then log into MySQL:
    mysql -u root
    
  5. Once you’re in the MySQL shell, run these commands to reset the password (replace your_new_password with the password you want to use):
    USE mysql;
    -- For MySQL 5.6 and older
    UPDATE user SET password=PASSWORD('your_new_password') WHERE user='root';
    -- For MySQL 5.7+
    UPDATE user SET authentication_string=PASSWORD('your_new_password') WHERE user='root';
    FLUSH PRIVILEGES;
    EXIT;
    
  6. Close both command windows, restart the MySQL service in XAMPP, then update the password line in config.inc.php to match your new password. Try logging in again.
4. Confirm MySQL is running

Sometimes the issue is simpler than you think—double-check that the MySQL service is actually running in the XAMPP control panel. If it says "Stopped", click "Start" to launch it, then refresh the phpMyAdmin page.

5. Clear your browser’s cache and cookies

Occasionally, old cached login data in your browser can cause this error. Clear your browser’s cache and any cookies related to your local phpMyAdmin instance (usually localhost/phpmyadmin), then reopen the page and try logging in again.

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

火山引擎 最新活动