1. PHP Conrainer is already running and accessible
(mine is combined nginx + php as a group)
2. MariaDB is running in the same docker host
and the container name is some-db-repl
3. PHP mysql connection host
like Adminer.php, host field can be some-db-repl (container name) instead of localhost or 127.0.0.1
when I got error in php:
SQLSTATE[HY000] [1045] Access denied for user 'root'@'17xxx3' (using password: YES)
AI suggested:
1. containers (php, mariadb) should be in same network
mine were already in web_default
2. in mariadb container exec
mysql -p
then
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
and it worked!