Skip to content

feat: add minimal Manager/Launcher support for changing the XAMPP MySQL port #63

Description

@lukaszpiotrluczak

Problem

The Classroom profile installs a portable XAMPP environment with MySQL/MariaDB and phpMyAdmin.

By default, MySQL usually uses port 3306. On student, teacher or workshop machines this port may already be occupied by another local database stack, for example:

  • another MySQL/MariaDB installation,
  • another XAMPP/WAMP/Laragon installation,
  • Docker containers,
  • database tools installed for another course or project.

When this happens, MySQL may fail to start, or phpMyAdmin may be unable to connect to the database server.

Currently, resolving this requires manually editing XAMPP configuration files. This is error-prone, especially in classroom environments and on machines used by beginners.

Codex 13 Student Dev Kit should provide a simple and safe way to change the MySQL port and keep phpMyAdmin configuration in sync.

Proposal

Add a minimal Manager/Launcher feature that allows the user to change the MySQL port used by the portable XAMPP installation.

This should be treated as a small first version of the future Codex 13 Student Dev Kit Manager/Launcher, not as a full Manager application.

The feature should:

  • detect the current SDK/XAMPP installation path,
  • detect and display the currently configured MySQL port,
  • allow the user to enter a new MySQL port, for example 3307,
  • validate the port before applying changes,
  • update the XAMPP MySQL/MariaDB configuration,
  • update phpMyAdmin so it connects to MySQL using the same port,
  • create backups of modified files before changing them,
  • show a clear success or failure message,
  • inform the user that XAMPP/MySQL should be restarted after the change.

Expected configuration files:

tools/xampp/mysql/bin/my.ini
tools/xampp/phpMyAdmin/config.inc.php

The MySQL configuration should be updated in the relevant sections, for example:

[client]
port=3307

[mysqld]
port=3307

phpMyAdmin should also be updated to use the same port, for example:

$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3307';

The implementation should preserve existing configuration as much as possible and only change the required values.

For the MVP, a command-based flow is enough, for example:

codex13-launcher configure-mysql-port

Example flow:

Current MySQL port: 3306

Enter new MySQL port: 3307

The following files will be updated:

- tools/xampp/mysql/bin/my.ini
- tools/xampp/phpMyAdmin/config.inc.php

Backups will be created before applying changes.

Apply changes? [y/N]

Validation should include:

  • port must be numeric,
  • port must be in the range 1–65535,
  • empty values should be rejected,
  • non-numeric values should be rejected,
  • optionally warn if the selected port appears to be already in use.

The feature should handle common error cases, including:

  • XAMPP is not installed,
  • expected configuration file is missing,
  • configuration file is read-only,
  • selected port is invalid,
  • selected port is already in use,
  • MySQL/XAMPP is currently running and needs to be restarted.

Acceptance criteria:

  • The user can change the XAMPP MySQL port using a minimal Manager/Launcher command or screen.
  • The current MySQL port is detected and displayed.
  • Invalid port values are rejected before any files are modified.
  • tools/xampp/mysql/bin/my.ini is updated correctly.
  • tools/xampp/phpMyAdmin/config.inc.php is updated correctly.
  • Backup files are created before modifying configuration files.
  • Existing unrelated configuration values are preserved.
  • The user is informed that XAMPP/MySQL should be restarted.
  • The feature works with portable SDK paths, including paths with spaces and non-ASCII characters.
  • Basic documentation or troubleshooting notes are added.

Alternatives

Several alternatives were considered:

  1. Leave the configuration manual

    Users could manually edit my.ini and phpMyAdmin/config.inc.php.

    This is not ideal because it is error-prone, difficult for beginners, and inconvenient in classroom environments.

  2. Add this only to documentation

    Documentation could explain how to change the MySQL port manually.

    This helps advanced users, but it does not solve the underlying usability problem. The SDK should make common classroom setup issues easier to fix.

  3. Build a full graphical Manager first

    A full Manager UI could include XAMPP configuration, port management, service status, logs and troubleshooting tools.

    This is useful long-term, but too large for the first step. A minimal command or simple screen is enough for the MVP.

  4. Change the default MySQL port globally

    The installer could use a non-standard default port such as 3307.

    This may avoid some conflicts, but it can also confuse users who expect the default MySQL port to be 3306. It also does not solve conflicts with other software using the alternative port.

The preferred approach is to keep the default configuration simple, but provide a safe Manager/Launcher action to change the port when needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementImprovement to an existing feature or behavior.featureRequest for a new feature or capability.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions