Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp-env: mysqlcheck: Got error: 1045: Access denied for user 'username_here'@'xxx.xx.x.x' (using password: YES) when trying to connect #29847

Closed
leeshadle opened this issue Mar 13, 2021 · 12 comments
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Tool] Env /packages/env

Comments

@leeshadle
Copy link

Description

Getting an 'Access denied error' from mysql when starting a local WordPress environment using the wp-env package.

Step-by-step reproduction instructions

  1. Create a block using create-block command:
    npx @wordpress/create-block --wp-scripts --wp-env wp-block

  2. Start wp-env using command:
    npx wp-env start

  3. Get an error in the terminal:
    mysqlcheck: Got error: 1045: Access denied for user 'username_here'@'xxx.xx.x.x' (using password: YES) when trying to connect

  4. Get an error when I go to localhost:8888:
    Error establishing a database connection

Code snippet (optional)

.wp-env.json:
{
"core": "WordPress/WordPress",
"plugins": [
"."
]
}

WordPress information

  • docker version: 3.2.1
  • wp-env version: 3.0.2
  • wp-scripts version: 13.0.3
  • node version: 12.16.1

Device information

  • Device: Desktop
  • Operating system: macOS Catalina version 10.15.7
  • Browser: Chrome Version 89.0.4389.82

Thank you for your help!!

@renatonascalves
Copy link

I'm getting the same error!

@ribaricplusplus
Copy link
Member

ribaricplusplus commented Mar 13, 2021

The issue was fixed in #29800 but that version of @wordpress/env hasn't been pushed to NPM yet , so if you want the fix you'll need to manually install the latest version of @wordpress/env. (if anyone is reading this after @wordpress/env v3.0.2 gets superseded, just install from npm, but read bolded below)

Here are 2 ways to install the latest version:

  1. Local dependency: Clone the gutenberg repository, navigate to packages/env, run npm pack, and then install the produced tarball
  2. Global dependency: Clone the gutenberg repository, navigate to packages/env, run npm install -g . (haven't done this personally but it should work)

Important: If you previously used wp-env in a project, unfortunately you'll have to run wp-env destroy and then wp-env start in order to make it work (after you update wp-env).

Related issue: #29752

@renatonascalves
Copy link

renatonascalves commented Mar 14, 2021

I tried two ways without luck (getting the same error).

npm i @wordpress/env@latest
npm i @wordpress/env@next

Destroying and starting again from scratch. Both are giving me the same:

✖ Error while running docker-compose command.
Creating bf292d91513c610b30731f7ee397005c_cli_run ... 
Creating bf292d91513c610b30731f7ee397005c_cli_run ... done
mysqlcheck: Got error: 1045: Access denied for user 'username_here'@'X.X.X.X' (using password: YES) when trying to connect

@ribaricplusplus
Copy link
Member

It's not pushed to NPM, you're not going to be able to install it that way.

@renatonascalves
Copy link

Ops! I see!

@renatonascalves
Copy link

Installing globally solved it for me.

@talldan
Copy link
Contributor

talldan commented Mar 15, 2021

Closing as a duplicate of #29752.

@talldan talldan closed this as completed Mar 15, 2021
@talldan talldan added [Tool] Env /packages/env [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Mar 15, 2021
@leeshadle
Copy link
Author

Here are 2 ways to install the latest version:

  1. Local dependency: Clone the gutenberg repository, navigate to packages/env, run npm pack, and then install the produced tarball
  2. Global dependency: Clone the gutenberg repository, navigate to packages/env, run npm install -g . (haven't done this personally but it should work)

Installing globally (option 2) worked for me too!

It doesn't work if @wordpress/env is already installed globallly. If that's the case run npm uninstall -g @wordpress/env and then run npm install -g . from the packages/env directory

Thank you!!

@nicolad
Copy link
Member

nicolad commented Mar 16, 2021

It's not pushed to NPM, you're not going to be able to install it that way.

setting the version this way might work:

"@wordpress/env": "https://gitpkg.now.sh/WordPress/gutenberg/packages/env?trunk"

as seen in jetpack ☝️

@ribaricplusplus
Copy link
Member

There are discussions in WordPress slack about this, and it's going to be updated in npm very soon.

@diegohaz
Copy link
Member

npx @wordpress/env@next start worked for me.

@porada
Copy link

porada commented May 12, 2021

I just encountered this issue and only the following worked for me:

npx @wordpress/env@next destroy
npx @wordpress/env@next start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Tool] Env /packages/env
Projects
None yet
Development

No branches or pull requests

7 participants