-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misconfiguration of MySQL socket pointer in PHP config. #3736
Comments
Hi @jails! Thanks for reporting this. We have a new set of images that are scheduled to be released at the end of next week. I'll make sure we have one of these solutions in place for that release and update this issue once the new images are available. |
Awesome 👍 |
Hello @rageshkrishna, did you tried to changes some database configuration recently to fix this issue ? Because I'm not able to create databases anymore. I'm getting the following error: mysql -e 'CREATE DATABASE `test`;'
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) My config file looks like: language: php
php:
- 7.1
services:
- mysql
branches:
only:
- master
build:
ci:
- mysql -e 'CREATE DATABASE `test`;'
... Thank you. |
hi @jails, I am able to run the build with your config https://app.shippable.com/github/niranjan92/samplePhp/runs/7/1/console. As per docs http://docs.shippable.com/ci/mysql/ , can you please try granting permissions to shippable user?
If this doesn't help, please share the link to the build. |
Ha right just added Thank you @niranjan92 |
Hi @niranjan92, The error is now the following: mysql -e "CREATE USER shippable@localhost IDENTIFIED BY ''; GRANT ALL ON *.* TO shippable@localhost; FLUSH PRIVILEGES;"
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Does the fact I'm playing with the root password like so: mysql -e "ALTER USER root@localhost IDENTIFIED BY 'root';" may be the issue ? Indeed if some things are cached between builds and the testing env is not completely immutable, the second run would require the setted password of the first run to execute the Here is the last failed build url of my private project: |
Since the MySQL database is running in the build container and a new container is started for each job, it's very unlikely that you're able to affect the next run without deliberately caching information or adding additional volume mounts to the container (neither of which you seem to be doing). It does look like there may be a connection between the length of time it took to start MySQL and the errors, although there aren't enough errors to be sure. The shorter start times being more likely to fail makes me suspect that MySQL may not have completely started when your first command runs. The I tried to reproduce the issue with the YML above and with the |
Thank you @a-murphy, I'll add a |
@jails we have fixed the original issue by creating a symlink for Please let us know if this is working for you so that we can close the issue. |
We have just stumbled upon this after switching from v5.7.3 to v5.10.4:
I tought there was a symlink from Even
|
Both Any chance something in your script is removing the contents of |
@a-murphy We never did something special for v5.7.3 or any previous version, you can check build 2524 of project |
Apparently the line |
I still haven't been able to reproduce your error. Have you tried clearing the cache? (There's a "reset cache" option on the project settings page.) Or moving the |
@a-murphy I just retried with resetting caches before building but the result is the same (see build 2536). I'll try to build a small repository which manually pulls in the latest drydock image via |
Hm, I tried this now and it worked just fine (network socket, UNIX socket). However, there is no interaction with MySQL at all until the |
That's definitely strange. It looks like MySQL is terminating for some reason in the older builds where mysqladmin failed to connect. Getting a tail of the mysql error log in |
@rageshkrishna I've added this to the original project now and this is what I get:
(See build 2539) So, MySQL is being shutdown during build? 🤔 |
@a-murphy @rageshkrishna We see the same issue again after upgrading the images from 5.7.3 to the latest version (6.3.4):
See for example build 373 of project Any ideas? |
@mbrodala this issue seems to have gone cold... is this still a problem for you? |
@manishas Since we're running mysql-based tests on the latest images just fine, the issue seems to be resolved. |
👍 |
Hi,
The PHP
--with-mysql-sock[=DIR]
compiling option sets the MySQL Unix socket pointer for all MySQL extensions, including PDO_MYSQL.On Drydock v5.7.3, PHP has been compiled with
/tmp/mysql.sock
as socket path:However
/var/run/mysqld/mysqld.sock
seems to be the MySQL Unix socket pointer (not 100% sure but shouldn't be hard to verify on your side through MySQL config files).This misconfiguration doesn't allow to use
localhost
as hostname for all PHP MySQL drivers and make connections impossible.This issue can be circumvented by using
127.0.0.1
as hostname which will force PHP drivers to use a network socket (instead of the misconfigured unix socket).It's not a big deal but it's kindda not obvious that
localhost
can't be used as hostname and I wouldn't be surprised that other PHP users experienced the same issue.If PHP can't be recompiled easily, it would be great to have at least the following symlink by default on instances once mysqld is started (as a workaround):
Thank you!
The text was updated successfully, but these errors were encountered: