docker的基本使用

查看容器docker ps -a

1
2
3
4
5
6
qyjdeMac-Pro:~ qyj$ docker ps -a 
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fa4fb7f73f09 mysql "docker-entrypoint..." 14 minutes ago Up 8 minutes 0.0.0.0:3306->3306/tcp upbeat_brown
34f892480146 mysql "docker-entrypoint..." 15 minutes ago Exited (1) 15 minutes ago vigilant_poitras
qyjdeMac-Pro:~ qyj$ docker exec -it upbeat_brown bash
root@fa4fb7f73f09:/# mysql -uroot -p

docker exec -it upbeat_brown bash

docker下使用mysql

1
2
3
4
5
6
docker pull mysql
docker run --name docker-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=wzy123 -d mysql

docker exec -it docker-mysql bash

mysql -u root -p

连接不上问题处理(ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password’ cannot be loaded: ÕÒ²»µ½Ö¸¶¨µÄÄ£¿é¡£)

1
ALTER  USER  'root'  IDENTIFIED  WITH  mysql_native_password  BY  '1234567';