Context:
I successfully deployed moodle with the official docker compose , configured for database mysql
and the latest version of moodle on github.
docker file compose:
version: "2"
services:
webserver:
environment:
MOODLE_DOCKER_DBTYPE: mysqli
MOODLE_DOCKER_DBCOLLATION: utf8mb4_bin
db:
image: mysql:5
command: >
--character-set-server=utf8mb4
--collation-server=utf8mb4_bin
--innodb_file_format=barracuda
--innodb_file_per_table=On
--innodb_large_prefix=On
environment:
MYSQL_ROOT_PASSWORD: "m@0dl3ing"
MYSQL_USER: moodle
MYSQL_PASSWORD: "m@0dl3ing"
MYSQL_DATABASE: moodle
Container configuration and deployment:
# configuración de variables de entorno usando git-bash.
export MOODLE_DOCKER_WWWROOT=/c/moodle
export MOODLE_DOCKER_DB=mysql
cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php
# Ejecutar contenedores en segundo plano y dejarlos corriendo
bin/moodle-docker-compose up -d
# Abrir para testeo manual:
bin/moodle-docker-compose exec webserver php admin/cli/install_database.php --agree-license --fullname="Docker moodle" --shortname="docker_moodle" --adminpass="test" --adminemail="[email protected]"
Ask:
I am trying to grant privileges to the moodle user (in order to be able to execute some commands that require elevated privileges) with the command:
GRANT ALL PRIVILEGES ON *.* TO 'moodle';
But I get the error:
ERROR 1045 (28000): Access denied for user 'moodle'@'%' (using password: YES)
How can I do it?
Note : I am using docker desktop on windows with WSL 2 enabled.
To run the command you must log in as root with:
Reference: