Wordpress (Self Hosted) - Error establishing a database connection RRS feed

  • Question

  • Hello,

    I am reaching out to the community for your help...please see below for what is going on:

    ***Please Note: This is a brand new WordPress installation***

    When trying to install WordPress I get this error:

    MySQL server has gone away Error establishing a database connection This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at This could mean your host’s database server is down. Are you sure you have the correct username and password? Are you sure that you have typed the correct hostname? Are you sure that the database server is running? If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    Here is my wp-config.php settings related to the current message I am getting:

    // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'learncoding' ); /** MySQL database username */ define( 'DB_USER', 'nethost' ); /** MySQL database password */ define( 'DB_PASSWORD', '[redacted]' ); /** MySQL hostname */ define( 'DB_HOST', '' ); /** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' ); /** The Database Collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' );

    define( 'WP_DEBUG', true );
    define( 'WP_MEMORY_LIMIT', '4096M' );

    These are the steps I have tried with Azure Support, VIA Twitter:

    1. Deleted an old database and created a new one - Still received a connection error.
    2. Reset "nethost" password, in case I was typing it wrong - Still received a connection error.
    3. Set my server IP into the DMZ on my router - Still received a connection error.
    4. Disabled DMZ and forwarded port 1433 (TCP and UDP) - Still received a connection error.
    5. Ran a script to see if I could connect to the DB - Still received a connection error.
    6. Double checked that the credentials were correct.
    7. Tried a couple of different connection strings - Still received a connection error.
    8. Increased PHP memory from 128M to 4GB
    9. Enabled debugging to see what other errors it might be throwing.
    10. Added my public IP to the firewall settings in the portal

    If you have any tips or suggestions, please let me know.

    Thank you,


    Saturday, June 15, 2019 1:52 AM

All replies

  • So, I was originally using IIS 8.5...I then made the following changes:

    1. Changed to v1.17.0 nginx
    2. Installed v7.3.6 PHP
    3. Enabled the mysqli extension in the php.ini file

    I am now getting the following error:

    The site is experiencing technical difficulties.

    Will investigate this tomorrow to see what might be causing it and report back.



    Saturday, June 15, 2019 5:39 AM
  • Are you creating this Wordpress instance on Azure?

    Azure SQL forum is not appropriate either for WordPress or MySQL issues.

    Monday, June 17, 2019 1:40 PM