Can't connect wordpress to database [Error establishing a database connection]

  • | 540 points

    I've tried all ways

    First info :
    OS: Windows 10 1909 updated
    Laragon: Last [ 4.0.16 ]

    I have tried these :

    • Fresh install both OS/LARAGON
    • Fresh PHP
    • Fresh MYSQL
    • Fresh Apache / NGINX
    • Fresh MARIADB
    • Fresh all things come to mind

    I've had
    Installed both OS/LARAGON and reinstalled uninstall registry
    The conflict between PHP on windows and PHP on Laragon
    Both installed and uninstall

    Nothing worked

    Seems Laragon broken and WordPress can't install on Laragon

    The interesting part is All things seems functional until WordPress installation
    The debug error of WP_DEBUG give developer this:

    Warning: mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.

    I've googled and tried around 50 website solution included WordPress community - Stacks series - And many other websites

    Note that XAMPP works fine
    Manual stacks are fine on my systems
    Just Laragon not work

    I work with XAMPP, Laragon and manual stacks (PHP + LiteSpeed, Nginx, Apache + MariaDB + MySQL)
    But Only Laragon not work
    Others working like a charm

    Something is wrong in laragon I after changing many ini and config files still cant install WordPress on it
    I think is Database side because the server is fine
    My hosts file is OK

    Thanks in advance

  • administrators
    | 131258 points

    @JARVIS-AI : Can you change MySQL port to another port? In Preferences > Services and Ports

  • | 540 points

    No sucess
    Still same error message

  • administrators
    | 131258 points

    @JARVIS-AI : Can you check the data dir?
    I am afraid there is something prevents Laragon from creating the data dir properly.
    If that is the case, you may need to move Laragon to D:\laragon instead of C:\laragon.

  • | 540 points

    It's already in D
    alt text

    alt text

  • | 540 points

    Now I tried with last apache and Nginx and MariaDB and MySQL
    Not work
    I truly don't know what it's problem
    On the other side on my system VHOSTS not work and now WORKING (The problem was hosts file) Now works fine on XAMPP
    So technically HTTP server and Database server are working fine on my system and JetBrain products using standalone PHP and Apache installed by scoop
    So EVERYTHING works fine except my love LARAGON

    None ports have any collision
    System is ready to accept to those ports on the screenshots I posted here

  • administrators
    | 131258 points

    @JARVIS-AI : When checking the data dir, did you check if it is corrupted?

  • | 540 points

    I check with Fresh database downloaded from MariaDB
    I think it should be fine

Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.