.env file is attacheddocker-compose.override.yml is attached (if it exists)cfg/ dir are attached (if customized)docker-compose logs and log/ output is addedI've looked through existing issues: https://github.com/cytopia/devilbox/issues
Clone the repo, start the project, and try to connect to mysql.
MySQL is up and accessible
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
⋊> ~ git clone https://github.com/cytopia/devilbox.git; cd devilbox; cp env-example .env; docker-compose up -d 11:37:25
Cloning into 'devilbox'...
remote: Enumerating objects: 18633, done.
remote: Total 18633 (delta 0), reused 0 (delta 0), pack-reused 18633
Receiving objects: 100% (18633/18633), 31.08 MiB | 6.22 MiB/s, done.
Resolving deltas: 100% (8063/8063), done.
Creating network "devilbox_app_net" with driver "bridge"
Creating devilbox_bind_1 ... done
Creating devilbox_php_1 ... done
Creating devilbox_httpd_1 ... done
Creating devilbox_memcd_1 ... done
Creating devilbox_redis_1 ... done
Creating devilbox_mongo_1 ... done
Creating devilbox_mysql_1 ... done
Creating devilbox_pgsql_1 ... done
⋊> ~/devilbox on master ◦ ./shell.sh 11:37:57
------------------------------------------------------------------------------------------
_ _ _ _
| | (_) | |
__| | _____ ___| | |__ _____ __
/ _` |/ _ \ \ / / | | '_ \ / _ \ \/ /
| (_| | __/\ V /| | | |_) | (_) > <
\__,_|\___| \_/ |_|_|_.__/ \___/_/\_\
http://devilbox.org
https://devilbox.readthedocs.io
Available Tools
https://devilbox.readthedocs.io/en/latest/readings/available-tools.html
How to work inside this PHP container
https://devilbox.readthedocs.io/en/latest/intermediate/work-inside-the-php-container.html
| Available Dirs | Description |
|------------------|------------------------------|
| /shared/httpd | Project base directory |
| /shared/backups | Backup directory |
| /var/mail | Email directory |
| /var/log | Log file directory |
------------------------------------------------------------------------------------------
[email protected] in /shared/httpd $ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
[email protected] in /shared/httpd $
$ docker-compose up -d
uid=1000(zack) gid=974(docker) groups=974(docker),998(wheel),1000(zack)
$ ls -la
drwxr-xr-x 4 zack docker 4096 Feb 15 11:37 .devilbox/
⋊> ~/devilbox on master ◦ ls -la data/www/ 11:40:39
total 8
drwxr-xr-x 2 zack zack 4096 Feb 15 11:37 ./
drwxr-xr-x 7 zack docker 4096 Feb 15 11:37 ../
-rw-r--r-- 1 zack docker 0 Feb 15 11:37 .keepme
@zack6849 MySQL is not running inside the PHP container. You should use:
mysql -u root -h mysql -p
Info:
When not specifying -h mysql (The host to use, which in this case is called mysql), then the connection defaults to use the local MySQL socket instead of doing a TCP connection. As no MySQL socket is present on the PHP container, the connection will fail. So to overcome this, you must explicitly tell it, to which host to connect.
FWIW I had exactly the same problem. Happy to find this solution here! The whole Docker thing is awfully confusing for those of us who do not have a lot of experience with it (which is devilbox's target audience, I think). Might be worth mentioning this in the docs.
@pnoeric Unfortunately for me it is quite obvious and I am unsure how to best formulate it that it is easy to grasp right from the very beginning. Do you have some description in mind that would have made it very obvious to you?
I would just put a couple of lines in the docs somewhere around where you "use" devilbox (maybe by the part about shell.sh) - "if you want to connect to the MySQL server directly from inside the container, you have to use this special command (so Docker knows to find the server over in its separate, special container)." Something like that. ;-)
I find myself often running shell.sh to drop in and then look at the MySQL server directly from there... so I was stuck until I found this.
Again, I suggest this only because I think your target audience for devilbox seems to be folks (like me) who aren't experts at Docker, so these folks don't really understand the concept of separate-but-linked containers for the various services.
I have rewritten the documentation and hope it does no present what actually needs to be done in Release v1.0.1
Most helpful comment
FWIW I had exactly the same problem. Happy to find this solution here! The whole Docker thing is awfully confusing for those of us who do not have a lot of experience with it (which is devilbox's target audience, I think). Might be worth mentioning this in the docs.