Support » Installing WordPress » Error establishing database connection

  • I had a working WordPress installation on my own self-managed server. I ended up doing a fresh OS installation (Ubuntu Server 22.04) after backing up all files and databases. I freshly installed apache, MariaDB (version 10.6.7), php (version 8.1.2), and php-mysql. I restored existing databases, including my WordPress database, from the backups. I created database users with the same names and same permissions as before. I tested logging in with the WordPress database user and password from the command line. I set up ufw as before, double checking that access to port 3306 is permitted from

    I followed the WordPress installation instructions here.

    1. Downloaded latest version of WordPress and unpacked on server. Moved to appropriate folder /var/www/html
    2. Restored database from backup, as mentioned above.
    3. I ran the installation script at
    4. I entered my database name, db username, and db password, which were all tested on the command line to ensure correctness. I’ve tried both localhost and in the host field and confirmed that my database table prefix is, in fact, the default wp_.

    I’ve done a ridiculous amount of Googling and searching these forums and I’m at a loss. I can’t get past the “Error establishing database connection” error message. I’ve also tried manually editing wp-config.php and that has the same result.

    I’ve consulted the guide to moving WordPress between servers, to make sure I didn’t do steps out of order. Since my domain and all file paths are exactly the same, I’m not seeing any explanation there.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error establishing database connection’ is closed to new replies.