skip to Main Content
Laradock SQLSTATE[HY000] [2002] Connection Timed Out

Somtimes tinkering with Laradock containers you may get a SQLSTATE[HY000] [2002] Connection timed out or to be more specifically

Illuminate\Database\QueryExceptionPOST /login
SQLSTATE[HY000] [2002] Connection timed out (SQL: select * from `users` where `email` = jasper@domain.test limit 1)

This could be because post rebuilding or loading the container got a new ip address. To check the ip addresses of all containers you can do a

docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)

to check them. Then you can change the ip address for the database containers accordingly. In our case we had


You can also use mariadb as the host as we mentioned it the Laradock Setup Snags Post.

Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top