I ran into a similar issue although not sure the solution would be exactly the same for your case.
TLDR; The database configuration for root
out-of-the-box is wrong…
(This is a really bad first expirience with getting DevKinsta setup)
Verify
To verify this I did the following:
# access the database container
docker exec -it devkinsta_db bash
# in the container, try to login provided credentials
mysql -p
The result was:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Resolve
The resolution was to set the root
password using mysqladmin
:
# access the database container
docker exec -it devkinsta_db bash
# set root password (use password provided in DevKinsta UI)
mysqladmin -u root password
# verify you can now access the database
mysql -p
# print the databases (optional)
show databases;
EDIT: I ran into further issues with the database configuration out-of-the-box.
The database user access is limited to localhost
but because of how the infrastructure/network is setup that means that no other service can access it. When it creates the website it says it was successful but then you run into a few issues:
- WordPress - “Error establishing a database connection”
- Adminer - “SQLSTATE[HY000] [2006] MySQL server has gone away”
Resolve
To resolve this you need to grant access from other hosts (in this case they are containers). None the less it’s fairly straightforward:
# access the database container
docker exec -it devkinsta_db bash
# login to mysql
mysql -p
# show access
show grants for 'root'@'localhost';
# copy the one that starts with "GRANT ALL PRIVILEGES" replace `root`@`localhost` with `root`@`%`
GRANT ALL PRIVILEGES ON *.* TO `root`@`%` IDENTIFIED BY PASSWORD '{ENCODED_PASSWORD}' WITH GRANT OPTION;
Now simply click “Retry” in the UI and it should get pass the error.