Connecting to MySQL thru Sail, Docker Container
Trying to connect to the MySQL database through the docker container like this:
/var/www/html$ mysql -h 127.0.0.1 -u sail -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)
Where's the error, on the Port or the IP that im using?
Thanks.
You should check your configuration in the file.env.
I believe the host should be the service name, example
mysql -h mysql -u sail -p
or you are using laravel 9 and above, you should able to connect the database by using the command
php artisan db
Please or to participate in this conversation.