Fixing 'unknown variable mysqlx_port=0.0' Error During MySQL 5.7 Installation on Windows

During installation of MySQL 5.7 on Windows, the proccess often fails at the database initialization stage with the error: unknown variable 'mysqlx_port=0.0'. This issue stems from the installer incorrectly including a MySQL 8.0+ specific configuration option (mysqlx_port) in the my.ini file, wich is not recognized by MySQL 5.7.

To resolve this, follow these steps:

  1. Locate and edit my.ini The configuration file is typically found at:

    C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
    

    Open it and comment out or remove the line containing mysqlx_port=0.0. Note that re-running the official installer will regenerate this file and reintroduce the problematic line, so avoid using the GUI installer after this point.

  2. Clear the data directory Delete all contents in the data folder:

    C:\ProgramData\MySQL\MySQL Server 5.7\Data
    
  3. Initialize the database manually Open a Command Prompt in the MySQL bin directory:

    C:\Program Files\MySQL\MySQL Server 5.7\bin
    

    Run the following command to initialize without a password:

    mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --console --initialize-insecure
    

    If you encounter encoding issues, save my.ini with ANSI encoding and retry.

  4. Start MySQL manually In the same bin directory, launch the server:

    mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --console
    
  5. Set root password In a new terminal window, connect as root (no pasword needed initially):

    mysql -u root
    

    Then execute inside the MySQL shell:

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourNewPassword';
    FLUSH PRIVILEGES;
    EXIT;
    
  6. Verify login Test the new credentials:

    mysql -u root -p
    
  7. Install as a Windows service (if supported) On most Windows editions, the installer registers a service named MySQL57. If it exists but won’t start, ensure the my.ini file no longer contains mysqlx_port. Start it via Services (services.msc).

    On Windows 11 Home or systems where the service fails to start, use a batch script to run MySQL manually. Create start_mysql.bat with:

    @echo off
    echo Starting MySQL Server...
    "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --console
    echo.
    echo MySQL Server started. Press any key to exit...
    pause >nul
    

    For automatic elevation, use this version:

    @echo off
    net session >nul 2>&1
    if %errorLevel% neq 0 (
        powershell -Command "Start-Process '%~f0' -Verb runAs"
        exit /b
    )
    echo Starting MySQL Server...
    "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --console
    echo.
    echo MySQL Server started. Press any key to exit...
    pause >nul
    

Tags: MySQL Windows database installation troubleshooting

Posted on Tue, 14 Jul 2026 16:52:31 +0000 by sades