• NB: this is, if not my first time, then my first time in many years posting here, so apologies if this is in the wrong spot.

    I seem to have broken my wp-env environment somehow, and can’t figure out how to diagnose it. This is on MacOS BigSur 11.2.2

    $uname -a
    Darwin cwr-space-grey-macbook-pro-2017.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

    I was successfully building and developing plugins with wp-env. Then I tried working on a theme, and in the process of getting that working, I seem to have broken something, and connection to the database is no longer working.

    % node -v
    v14.16.0
    % npm -v 
    6.14.11
    % wp-env --version
    3.0.2
    % npx @wordpress/create-block foo
    ...
    Done: block "Foo" bootstrapped in the "foo" folder.
    % cd foo
    % wp-env start
    ? Error while running docker-compose command.
    Creating e6bc9159b910bda3d9b0dae2e230eabd_cli_run ... done
    mysqlcheck: Got error: 1130: Host '172.30.0.5' is not allowed to connect to this MariaDB server when trying to connect

    Like I said, this was working before, so I broke something, but … I have no idea what or where. The docker containers seem to be up and running:

    % ls ~/.wp-env
    e6bc9159b910bda3d9b0dae2e230eabd
    $docker volume ls | grep e6bc9159b910bda3d9b0dae2e230eabd
    local     e6bc9159b910bda3d9b0dae2e230eabd_mysql
    local     e6bc9159b910bda3d9b0dae2e230eabd_phpunit-uploads
    local     e6bc9159b910bda3d9b0dae2e230eabd_tests-wordpress
    local     e6bc9159b910bda3d9b0dae2e230eabd_wordpress
    $docker network ls | grep e6bc9159b910bda3d9b0dae2e230eabd                       
    7d2f51c7f1fa   e6bc9159b910bda3d9b0dae2e230eabd_default   bridge    local
    $docker ps
    CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS         PORTS                     NAMES
    250bb487f0e0   wordpress   "docker-entrypoint.s…"   5 minutes ago   Up 4 minutes   0.0.0.0:8889->80/tcp      e6bc9159b910bda3d9b0dae2e230eabd_tests-wordpress_1
    7e385d6b7b21   wordpress   "docker-entrypoint.s…"   5 minutes ago   Up 4 minutes   0.0.0.0:8888->80/tcp      e6bc9159b910bda3d9b0dae2e230eabd_wordpress_1
    b10e0260db11   mariadb     "docker-entrypoint.s…"   5 minutes ago   Up 5 minutes   0.0.0.0:55019->3306/tcp   e6bc9159b910bda3d9b0dae2e230eabd_mysql_1
    $docker exec -it b10e0260db11 /bin/bash
    root@b10e0260db11:/# ps auxw
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    mysql        1  0.0  3.9 1345280 79596 ?       Ssl  07:37   0:00 mysqld
    root        59  1.7  0.1   4248  3384 pts/0    Ss   07:42   0:00 /bin/bash
    root        67  0.0  0.1   5900  2924 pts/0    R+   07:42   0:00 ps auxw
    root@b10e0260db11:/# 

    I tried uninstalling and re-installing wp-env. I tried nuking everything (removed ~/.npm ~/.nvm ~/.wp-env) and reinstalling. I even tried rolling back to an older wp-env:

    % wp-env --version
    2.1.0

    Does anyone have any idea what’s going on here, or what other steps I can take to diagnose it?

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator bcworkz

    (@bcworkz)

    Yeah, the server not being allowed to connect to the DB is a problem. Verify the connection parameters are all correct in wp-config.php. Through phpMyAdmin verify the user WP is using has adequate permissions for the WP database. Try setting a new password for that user, and updating wp-config.php accordingly.

    If all that checks out perhaps there’s a firewall rule blocking access and an exception needs to be made.

    I’m seeing something similar with my wp-env install, it was working fine then suddenly started throwing the following error on wp-env start

    Configuring WordPress.mysqlcheck: Got error: 1045: Access denied for user ‘example username’@’172.19.0.5’ (using password: YES) when trying to connect

    Moderator bcworkz

    (@bcworkz)

    Thread Starter cwrichardson

    (@cwrichardson)

    @bcworkz — yes, I had tried all of those things.

    @jdub233 — I never did find out exactly what was causing the problem, but I guess it was a corrupted docker image cached somewhere. Previously, removing docker and reinstalling had not fixed it; however, removing NPM NVM and Docker and reinstalling all 3 resolved the issue for me. ˉ\_(ツ)_/ˉ

    @cwrichardson Thanks for following up, I updated to the latest 4.0.0 version of wp-env and suddenly it started working again. Hope to keep it working, it’s been very useful!

    My coworker had similar problem.

    ? Error while running docker-compose command.
    Creating 089135d6fcdff73270753921a88fbffc_cli_run …
    Creating 089135d6fcdff73270753921a88fbffc_cli_run … done
    mysqlcheck: Got error: 1045: Access denied for user ‘root’@’172.18.0.6’ (using password: NO) when trying to connect
    2

    If there were wp-config.php in folder that executewp-env start, solved by remove wp-config.php and runwp-env start.

    And, If wp-config.php existed ~/.wp-env/<containerId>/<execute wp-env folder>/, remove that wp-config.php too and regenerate by wp-env start.

    Regenerating wp-config.php solved my coworker’s error.

    Perhaps, this problem occur after update wp-env v3 or lower to v4.

    • This reply was modified 3 years, 4 months ago by akiya.
    • This reply was modified 3 years, 4 months ago by akiya.
    • This reply was modified 3 years, 4 months ago by akiya.
    • This reply was modified 3 years, 4 months ago by akiya.
    • This reply was modified 3 years, 4 months ago by akiya.

    I found another way.

    How to Fix MariaDB Error 1130 with wp-env and Docker – Greys
    https://greys.co/how-to-fix-mariadb-error-1130-wp-env-docker/

    1. Find container name by docker ps.
      Container name is about 30 alphanumeric characters like ‘cf510f85552bd2693a6907b36da3b3a3’
    2. Move folder cd ~/.wp-env/<container name>/.
    3. Execute docker comand, docker-compose down -v
    4. docker-compose up
    5. Move your project folder cd ~/my_project and run wp-env start
    • This reply was modified 3 years, 4 months ago by akiya.
    • This reply was modified 3 years, 4 months ago by akiya.
    • This reply was modified 3 years, 4 months ago by akiya.
    • This reply was modified 3 years, 4 months ago by akiya.

    The same problem with me also happens, and I solve it by doing what @akiya said:

    Find container name by docker ps.
    Container name is about 30 alphanumeric characters like ‘cf510f85552bd2693a6907b36da3b3a3’
    Go to folder cd ~/.wp-env/<container name>/.
    Execute docker comand, docker-compose down -v
    docker-compose up
    Move your project folder cd ~/my_project and run wp-env start
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘wp-env can’t connect to database’ is closed to new replies.