1

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..

3
  • is the database Server started? Commented Aug 9, 2016 at 19:06
  • You should describe what are you doing step-by-step so that the issue is reproducible. It is unlikely that you get help otherwise. Please also consider asking at wordpress.stackexchange.com. Commented Aug 9, 2016 at 21:16
  • Possible duplicate of WordPress Error establishing a database connection Commented Sep 3, 2018 at 23:44

2 Answers 2

1

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'

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.