Dilka Dilukshi
Dilka Dilukshi

Reputation: 45

"Localhost Error establishing a database connection "

I am new to WordPress, and I am trying to setup it at my local machine.

I am getting error like "Error establishing a database connection".please help me to solve this error..

Upvotes: 1

Views: 808

Answers (2)

Alex Seidler
Alex Seidler

Reputation: 74

This is not exactly the proper way to address the problem, it's invaluable to learn how to navigate and work with the wp-config file, Apache, and MySQL - but this should solve your problem, and is very friendly for someone just getting started with this sort of thing.

The correct fix (in my opinion) is to set up a WAMP server, or at least Apache, MySQL, and PHP to run Wordpress locally.

You probably are looking for something more like: http://www.instantwp.com/

I have used it before. Basically, you install and it creates a virtual temporary server where you can develop without needing to mess with the details of Apache, wp-config, or SQL. Very easy, hope that helps. Cheers.

Upvotes: 1

Devansh Modi
Devansh Modi

Reputation: 110

Without your database code, it is hard to figure the exact reason.

The error is usually due to:

Your MySQL server is not running. So you need to run this command if you are on a Linux machine (May not work for Ubuntu):

/etc/init.d/mysqld start

Or,

  • The MySQL user does not have the privileges to access the Wordpress database

  • The port 3306 is blocked. Check what other program is using that port.

  • The host name in Wordpress configuration is not correct. Make sure it is 'localhost'

Upvotes: 1

Related Questions