I am new to wordpress but not to programming to please bear with me. I am trying to get a new wordpress project up and running locally using the wp-cli.

But when I run the following command:

wp core install --url=example.com --title=WP-EXAMPLE --admin_user=******* --admin_password=****** --admin_email=******

I get the following error:

Error: Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or we can’t contact the database server at `localhost`. This could mean your host’s database server is down.

I was able to run the wp config create and wp db create commands without issue and a database was create so I know that the database username and password are correct. Is there a step I am missing?

The output of wp --info is as follows:

OS: Darwin 17.6.0 Darwin Kernel Version 17.6.0: Tue May  8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
Shell:  /bin/zsh
PHP binary: /usr/bin/php
PHP version:    7.1.16
php.ini used:
WP-CLI root dir:    phar://wp-cli.phar
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /Users/admin/code/wp-example
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 1.5.1

Since there are so many blank items I feel as though I am missing something although I have following all of the steps that I have found in quick start guides for setting up wordpress from the CLI.

Thanks in advance.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.