Closed sunlingfeng-daren closed 9 years ago
@sunlingfeng-daren you need to add --volumes-from=mysql
, not --link mysql:db
Dear sir: can u tell me why I must use --volumes-from=mysql? Thanks!
@sunlingfeng-daren That is because in the mysql -uroot
command you are not specifying the mysql server hostname or port. By default the mysql client will try to connect to the unix socket of the mysql server.
The --volumes-from mysql
volume mounts the socket directory of the mysql server container inside the client container, thereby making the unix socket available in the client container. As a result, the mysql client can connect to the mysql server using the unix socket
I see. thanks for your help!
Dear sir: I use this command docker run -i -t --rm --link mysql:db sameersbn/mysql mysql -uroot -h db,it show errors: ERROR 1045 (28000): Access denied for user 'root'@'10.0.0.28' (using password: NO); when I use this :docker run -i -t --rm --volumes-from=mysql sameersbn/mysql mysql -uroot, I can login to use mysql console.
I want to know what is different between two commands? thks!