MySQL Password Configuration in XAMPP Environment and Apache Port Conflict Resolution

Nov 23, 2025 · Programming · 11 views · 7.8

Keywords: XAMPP | MySQL | phpMyAdmin | Apache | Port Configuration | Password Setup

Abstract: This article provides a comprehensive analysis of configuring MySQL server passwords in XAMPP integrated environment to resolve phpMyAdmin access denial issues, along with multiple effective methods for handling Apache server port conflicts. Through detailed examination of key parameter modifications in config.inc.php configuration file, it explains how to properly set authentication type, username, and password fields. For port occupation problems, practical techniques including modifying httpd.conf configuration file and using system tools to release ports are presented, assisting developers in successfully setting up local development environments.

Problem Background and Error Analysis

In XAMPP integrated development environment, users frequently encounter two typical issues: phpMyAdmin failing to connect to MySQL server displaying "Access denied for user 'root'@'localhost'" error, and Apache server failing to start due to port conflicts. The root cause of the first problem lies in the mismatch between MySQL authentication information specified in phpMyAdmin configuration file and the actual database server, particularly when multiple MySQL instances exist in the system.

phpMyAdmin Configuration Correction

To resolve MySQL connection authentication failures, key configuration parameters in the phpmyadmin/config.inc.php file under XAMPP installation directory need to be modified. The original configuration typically contains the following code segment:

$cfg['Servers'][$i]['auth_type']    = 'config';
$cfg['Servers'][$i]['user']         = 'pma';
$cfg['Servers'][$i]['password']     = '';
$cfg['Servers'][$i]['controluser']  = 'user_name/root';   
$cfg['Servers'][$i]['controlpass']  = 'passwaord';

These configuration items need to be modified to match the actual MySQL server values:

$cfg['Servers'][$i]['auth_type']    = 'config';
$cfg['Servers'][$i]['user']         = 'root';
$cfg['Servers'][$i]['password']     = 'Muhammad Ashikuzzaman';
$cfg['Servers'][$i]['controluser']  = 'root';   
$cfg['Servers'][$i]['controlpass']  = 'Muhammad Ashikuzzaman';

Here, auth_type set to config indicates using static authentication information from the configuration file, both user and controluser should be set to the actual MySQL username (typically root), while password and controlpass need to be set to the corresponding MySQL user password.

Apache Port Configuration Adjustment

When Apache server fails to start due to port 80 being occupied, two solution approaches can be adopted:

Method 1: Modify Apache Listening Port

In the xampp/apache/conf/httpd.conf configuration file, two key locations need modification:

First, change ServerName localhost:80 near line 184 to ServerName localhost:81 (or other available port).

Second, modify the listening configuration near line 45, replacing:

#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80

with:

#Listen 0.0.0.0:81
#Listen [::]:81
Listen 81

Method 2: Release Occupied Port 80

If continuing to use standard port 80 is desired, the process occupying this port needs to be identified and stopped. In Windows systems, common programs occupying port 80 include Skype and World Wide Publishing Service.

The following steps can identify the occupying process:

  1. Open Task Manager and switch to the "Services" tab
  2. Look for "World Wide Publishing Service" and stop this service
  3. If this service is not found, run resmon.exe and check port 80 occupation status under "Network" tab → "Listening Ports"
  4. Under "Overview" → "CPU" tab, right-click the occupying process and select "End Process Tree"

It's important to note that if port 80 is occupied by system-critical processes, forced termination may affect system stability. In such cases, modifying Apache port is recommended.

Configuration Verification and Testing

After completing the above configuration modifications, Apache and MySQL services need to be restarted for changes to take effect. This can be done through XAMPP control panel or command-line tools.

Steps to verify phpMyAdmin configuration correctness:

  1. Access http://localhost:port_number/phpmyadmin in browser
  2. If normal login and database management interface display occurs, configuration is successful
  3. If authentication errors persist, check if MySQL server is running properly and if passwords in configuration file are correct

Steps to verify Apache port configuration:

  1. Access http://localhost:new_port_number in browser
  2. If XAMPP welcome page displays, port configuration is successful
  3. Verify port listening status using netstat -ano | findstr :port_number command

Multiple MySQL Instance Management Recommendations

When multiple MySQL server instances exist in the system (such as XAMPP built-in MySQL and independently installed MySQL), the following points should be noted:

Through proper configuration management, multiple MySQL instances can run simultaneously on the same machine, meeting different development and testing requirements.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.