Error Establishing A Database Connection WordPress Linux

Apache Friends Support Forum

Error establishing a database connection: XAMPP WordPress

Error establishing a database connection: XAMPP WordPress

by sgollor » 22. February 2017 23:49

Good day Everyone,

Please I’d be delighted if I can get some help with this. There’s a lot of documentation on this but my troubleshooting has failed. Im sorry if this is a repetition. I installed XAMPP for windows which works fine but it is not working for my MAC OS Sierra.

My XAMPP version is 5.6.30-0
My servers are running.

This is my wp-config.php details:

Code: Select all // ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘WP’);

/** MySQL database username */
define(‘DB_USER’, ‘admin’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘darkall’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

/** 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’, ”);

The user "admin" is a new user I created just for the "WP" database in phpMyAdmin.

I tried to go to http://localhost/wp/ but get the error "Error establishing a database connection""

I’ve also tried adding images to this post but I cannot get my head around it just yet, hopefully with time.

I want to keep this short for now but I will give more information as it may be required.

Thank you very much.

Re: Error establishing a database connection: XAMPP WordPres

by sgollor » 23. February 2017 10:39

The issue has been fixed.

I replaced curly quoted with single quotes. This is the new config.php file.

Code: Select all /** MySQL database username */
define(‘DB_USER’, ‘admin’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘darkall’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

/** 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’, ”);

处理WordPress 出现“Error Establishing a Database Connection”

Error establishing a database connection

Fix ‘Error Establishing a Database Connection’ WordPress error

Steps to follow when your WordPress Site spits out an Error Establishing a Database Connection error.

Ten to one the problem is in the wp-config.php file to be found in the public_html folder on the web server hosting your domain.

Step by Step:

  1. Open Cpanel of your web site (if you are hosted on a linux machine)
  2. Go to File Manager and navigate to public_html
  3. Find wp-config.php and download to a PLAIN TEXT Editor
  4. In Cpanel open up MySQL Databases
  5. Check that the Database Name and Database User Names are the same
  6. If not change those values to reflect the values as displayed in MySQL in Cpanel
  7. At this stage it would be prudent to change the Database Username Password as well via the MySQL screen in Cpanel
  8. Then save and upload the new wp-config.php file
  9. If you are New to this then RENAME the existing wp-config.php file to something else BEFORE uploading the new wp-config.php file.

Refresh and check – normally this works first time.

If not, check that you are using a plain text editor and then run a check and repair uitility on the database.

Leave a Reply

Your email address will not be published. Required fields are marked *