Title: Error establishing a database connection on Linux localhost
Last modified: February 7, 2023

---

# Error establishing a database connection on Linux localhost

 *  Resolved [rod](https://wordpress.org/support/users/nomadarod/)
 * (@nomadarod)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-on-linux-localhost/)
 * Hi,
 * My hosting period finished and I’m trying to recreate my website on my laptop(
   ubuntu) so that I can recover the contents in the pages more easily when creating
   the website online in a new host. (It was a compromised host so I don’t want 
   to simply bring the wp-content folder to the new location)
 * So I followed this link in order to install WP in my laptop: [https://ubuntu.com/tutorials/install-and-configure-wordpress#7-configure-wordpress](https://ubuntu.com/tutorials/install-and-configure-wordpress#7-configure-wordpress)
 * but in the end I have a “**Error establishing a database connection**” and cannot
   proceed to the install.
 * I don’t know how to edit the database or check it’s name when on a laptop. I 
   tried to install phpmyadmin through this tutorial: [https://www.linuxshelltips.com/install-phpmyadmin-in-linux/](https://www.linuxshelltips.com/install-phpmyadmin-in-linux/)
   
   but I get a “not found” when typping [http://localhost/phpmyadmin](http://localhost/phpmyadmin)
   in my browser.
 * How can I recover the content from the pages in order to copy-paste them to the
   new site?
 * Hope it is not so confusing,
 * Rod

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [3 years, 4 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-on-linux-localhost/#post-16449073)
 * first thing — is mysql installed and running? If so, are the necessary PHP libraries
   also installed? Do the DB_ values in wp-config.php match how youy’ve set up your
   system?
 * If you’re not good at sysadmin, install [https://localwp.com/](https://localwp.com/)
   for a totally easy to use and self-contained WP installation.
 *  Thread Starter [rod](https://wordpress.org/support/users/nomadarod/)
 * (@nomadarod)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-on-linux-localhost/#post-16481724)
 * Thank you Steven. Issue solved after renaming wp-config-sample.php for wp-config.
   php and reinserting the values.
 *  Thread Starter [rod](https://wordpress.org/support/users/nomadarod/)
 * (@nomadarod)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-on-linux-localhost/#post-16481725)
 * Resolved

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Error establishing a database connection on Linux localhost’ is closed
to new replies.

## Tags

 * [database connection](https://wordpress.org/support/topic-tag/database-connection/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 3 replies
 * 2 participants
 * Last reply from: [rod](https://wordpress.org/support/users/nomadarod/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-on-linux-localhost/#post-16481725)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
