docker
docker copied to clipboard
Tip: Stopping the "Access denied for user 'root'@'localhost' (using password: NO)" warnings in DB logs
While troubleshooting an issue I was having, I noticed a number of Issues here have the "Access denied for user 'root'@'localhost' (using password: NO)" warning in the database logs in common, and thought I'd offer this tip.
It's caused by the healthcheck test command in the database section.
By default it's set to: test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
That command accepts --password=<password>
as a parameter, so you can modify the test to:
test: ["CMD", "mariadb-admin" ,"ping", "-h", "localhost", "--password=<value_of_MYSQL_ROOT_PASSWORD_variable>"]
You should never see another healthcheck-related access denied warning.
Edit (2023-06-26): MariaDB seems to have recently removed/replaced the mysqladmin
command with mariadb-admin
. The latter provides the same functionality.