1

In Ubuntu 20.04 wp-env is giving me error once i have installed it and while trying to start it with wp-env start .The error showing is mysqlcheck: Got error: 1130: Host '172.29.0.5' is not allowed to connect to this MariaDB server when trying to connect.

I have tried....... CREATE USER 'wp'@'%' IDENTIFIED BY 'newpass'; GRANT ALL PRIVILEGES ON *.* TO 'wp'@'%';

sudo service mysql restart .

Changed the wp-config with new user and password keeping the DB_HOST same as earlier ( ie; localhost)

Still i am getting the same error . Can somebody please let me know what i have done wrong ?

5
  • You may need to open an issue on the official github repo, this looks like a docker issue not a WordPress issue. I've opened a Q on the meta site asking if WP Env is in the scope of this site wordpress.meta.stackexchange.com/questions/4732/…
    – Tom J Nowell
    Mar 14, 2021 at 12:30
  • I know it is not a WP specific question , but thought there would be somebody who have faced the same ............ actually it is a MySQL issue i think .
    – Anoop D
    Mar 14, 2021 at 12:44
  • Then this might be better asked on another stack, either way the best place to ask this is on the github repo, you should not be encountering this kind of problem, the maintainers need to know
    – Tom J Nowell
    Mar 14, 2021 at 12:49
  • Sure so ......... should i delete this question from here ? Or wait for a day or two ?
    – Anoop D
    Mar 14, 2021 at 12:50
  • 1
    I don't see why this question should be deleted
    – Tom J Nowell
    Mar 14, 2021 at 15:07

2 Answers 2

2

Step 1: Find the name of your wp-env container

First, you need to locate the name of the container created by wp-env. To do this, in the directory of your project containing .wp-env.json, you must run the following command:

docker ps

This should give you a list of containers. In the Names column, you’ll see the following information:

7b3099bc856ae9db898a196c0465cadb_wordpress_1
7b3099bc856ae9db898a196c0465cadb_tests-wordpress_1
7b3099bc856ae9db898a196c0465cadb_mysql_1

In this example, “7b3099bc856ae9db898a196c0465cadb” is the name of the container created by wp-env.

Step 2: Access the directory containing your docker-compose file

Once you have the name of your wp-env container, you can use it to access the directory containing the docker-compose file created by wp-env. To do so, run the following command in your terminal:

cd ~/.wp-env/7b3099bc856ae9db898a196c0465cadb
docker-compose down -v
docker-compose up -d

This should create a fresh environment.

Step 3: Restart wp-env

Finally, go back to your project folder and run:

wp-env start

You should then receive a message informing you that your WordPress dev environment is ready.

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

1
  • I'm not sure why, but for me the directory was without a dot, so cd ~/wp-env/9928495e3780fb029b90f57492529982. May 23, 2022 at 22:05
0

In my case, the error caused "Error establishing a database connection error".

It could be solved by following the instructions above and installing @wordpress/env 4.0.0+.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.