docker exec -it web bash
root@web:/var/www/html/myproject/doctrine/config/config.yml
This is my config.yml looks like
connections.demo.dbname: "demo"
connections.demo.host: mysql
connections.demo.password: password
connections.demo.port: null
connections.demo.user: user
a container is like a system, it gets its own IP address. so, if the WEB app(system/container) wants to talk to the MYSQL(system/container) , you must use the mysql client syntax that identifies where the server is…
the --link mysql:mysql
means that in the environment of the WEB container is the info on where the MYSQL container is and the ports it exposes…
docker exec web env
will dump that info out
as for the 1st part…
when you started the MYSQL container, you told it a SPECFIC database to use
docker run --name mysql2 -e MYSQL_ROOT_PASSWORD=password -d mysql:5.6
I took this command from docker hub
so what’s the difference , my problem is that i can’t create a new database using php bin/console
and i need to know why , why the system can’t know the new database that’s declared in parametres.yml in my web project
I even add the server_version: 5.6 in the configuration file
And it’s the same result
MYSQL_ROOT_HOST: By default, MySQL creates the ‘root’@‘localhost’ account. This account can only be connected to from inside the container. To allow root connections from other hosts, set this environment variable. For example, the value 172.17.0.1, which is the default Docker gateway IP, allows connections from the host machine that runs the container. The option accepts only one entry, but wildcards are allowed (for example, MYSQL_ROOT_HOST=172...* or MYSQL_ROOT_HOST=%).
No i used but not with container concept,
I read many docs , and apply allmost what’s need to be done ,
but its teh same result
But now i exec the mysql container and i create the database sf_demo manually
after that i execute
php bin/console doctrine:schema:update --dump-sql
An exception occurred while executing ‘SELECT w0_.value AS value_0 FROM web_param w0_ WHERE w0_.cle = ‘_host’’:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sf_demo.web_param' doesn't exist
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sf_demo.web_param' doesn't exist
[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sf_demo.web_param' doesn't exist
So i think the pb now is not about container but its about an indexing table that is not created