docker-compose conectar a mysql de otro contenedor code example
Example: docker conectar a mysql de otro contenedor
$ docker exec -it mysql-db mysql -p
...
mysql> create database demo;
Query OK, 1 row affected (0.32 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| demo |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql>