Can't sign into mariadb when using docker swarm secrets due to unix socket authentication #22003
Open
1 task done
Labels
status/triage
Needs triage
Is this a docs issue?
Type of issue
I can't find what I'm looking for
Description
Unable to log into the root user of MariaDB after setting up a docker swarm service for MariaDB using secrets. When I type the root password in, I get an access denied error.
Location
https://docs.docker.com/engine/swarm/secrets/
Suggestion
I think it should be mentioned in the secrets section of the docs that MariaDB 10.4+ defaults to unix socket authentication. With Unix socket authentication in MariaDB, only users mapped to a system (Linux) user account can log in without a password. This authentication method allows users to connect if they are logged into the system as a user that matches a MariaDB user. If not it will not log you in. You can pass the password secret file inline with the command to sign into MariaDB and it will log into root. I didn't see any mention of this in the secrets section of the docs. I may have missed it, in which case, I'm sorry for taking up your time.
A fix for this would be disabling unix_socket and switching back to password authentication in MariaDB.
With more help from AI, I found that adding this command:
["--skip-grant-tables", "--skip-networking"]
to the MariaDB service section of the .yml worked, allowing me to sign into root by typing the password stored in the secrets file.Example docker config file for a test MariaDB swarm service:
Testing MariaDB root sign in with
["--skip-grant-tables", "--skip-networking"]
added to the config:Chat GPT also mentions this as a fix but I have not tried it and you would have to already have a mariadb shell:
ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('yourpassword');
The text was updated successfully, but these errors were encountered: