Skip to content
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

Mysql overrides don't work on traditional Windows #3801

Closed
1 task done
rfay opened this issue May 4, 2022 · 5 comments
Closed
1 task done

Mysql overrides don't work on traditional Windows #3801

rfay opened this issue May 4, 2022 · 5 comments

Comments

@rfay
Copy link
Member

rfay commented May 4, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Run a Diagnostic and Paste Link Here

No response

Current Behavior

On Windows, as reported by Jon McLaughlin in https://discord.com/channels/664580571770388500/961636249985237103

  • Mysql overrides in .ddev/mysql/*.cnf don't work.
Ensuring write permissions for servis2
mysql: [Warning] World-writable config file '/mnt/ddev_config/mysql/group_concat_max_length.cnf' is ignored.
mysql: [Warning] World-writable config file '/mnt/ddev_config/mysql/local_infile.cnf' is ignored.

This is a result of trying to use the mounted Windows directory directly (/mnt/ddev-config), for which permissions are not in our control.

DDEV 1.17.0-alpha6 seems to have introduced this; prior to that, the config files were copied into /etc/mysql in the container to solve exactly this problem. The problem originates with the removal of this line, https://github.com/drud/ddev/pull/2806/files#diff-db674dfd9698544c77815b1df958a12fb4d5b4a2a1ec2b3f167cf30c44be901dL50

(and of course, directly including /mnt/ddev_config/mysql)

Expected Behavior

You should be able to use mysql overrides on Windows.

Steps To Reproduce

On windows, use any mysql override.

Anything else?

Proposed workaround from the Discord channel is to install the needed overrides using a custom .ddev/db-build/Dockerfile:

ARG BASE_IMAGE
FROM $BASE_IMAGE

# MySQL customizations.
RUN echo -e "[mysqld]\n group_concat_max_len = 4096" > /etc/mysql/conf.d/group_concat_max_length.cnf
RUN echo -e "[mysqld]\n local_infile = true" > /etc/mysql/conf.d/local_infile.cnf
@JonMcL
Copy link

JonMcL commented May 5, 2022

What about just let traditional Windows use the old method?

# If we have extra mariadb cnf files,, copy them to where they go.
if [ -d /mnt/ddev_config/mysql ] && [ "$(echo /mnt/ddev_config/mysql/*.cnf)" != "/mnt/ddev_config/mysql/*.cnf" ] ; then
  if [ "${OS:-$(uname)}" = "Windows_NT" ] ; then
    sudo cp /mnt/ddev_config/mysql/*.cnf /etc/mysql/conf.d
    sudo chmod -R ugo-w /etc/mysql/conf.d
  else
    echo "!includedir /mnt/ddev_config/mysql" >/etc/mysql/conf.d/ddev.cnf
  fi
fi

I haven't tested this and I'm not particularly skilled at writing bash scripts, so please excuse potential mistakes :)

@rfay
Copy link
Member Author

rfay commented May 5, 2022

I'm not sure why all projects can't use the old method, but what you propose would be OK, except for the added complexity.

@JonMcL
Copy link

JonMcL commented May 5, 2022

Yes, using the "old" method on all host OS's might be a valid solution as well. I'm not involved enough to place value on the change. The new method did teach me that !includedir is a thing that works in MySQL cnf files.

@rokclimb15
Copy link
Contributor

I encountered this bug today. The workaround with the Dockerfile works, but is less than ideal. Any concerns with a patch implementing the "old" method? I'm glad to pick up this work.

@rfay
Copy link
Member Author

rfay commented Aug 4, 2023

I don't mind if you want to do that!

rokclimb15 added a commit to rokclimb15/ddev that referenced this issue Aug 6, 2023
rfay pushed a commit to rokclimb15/ddev that referenced this issue Aug 15, 2023
@rfay rfay closed this as completed in 5654135 Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants