先查询MySQL源
docker search mysql
也可以去官网查看镜像tag,选择自己需要的版本,否则会下载最新版本:https://hub.docker.com/_/mysql/
然后报错了!!!
root@deepin-PC:/etc/apt# docker pull mysql:8.0.11
Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/8.0.11: Get https://auth.docker.io/token"DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=http://f2d6cb40.m.daocloud.io\"" | sudo tee -a /etc/default/docker
重启docker
sudo service docker restart
再试一下
root@deepin-PC:/etc/docker# docker pull mysql:8.0.11
8.0.11: Pulling from library/mysql
be8881be8156: Pull complete
c3995dabd1d7: Pull complete
9931fdda3586: Pull complete
bb1b6b6eff6a: Pull complete
a65f125fa718: Pull complete
2d9f8dd09be2: Pull complete
37b912cb2afe: Pull complete
90a9e6fd6a27: Pull complete
959ebd3ef120: Pull complete
5eda665eddc4: Pull complete
d9007173a367: Pull complete
239f4d989075: Pull complete
Digest: sha256:ffa442557c7a350939d9cd531f77d6cbb98e868aeb4a328289e0e5469101c20e
Status: Downloaded newer image for mysql:8.0.11
docker.io/library/mysql:8.0.11
验证一下
root@deepin-PC:/etc/docker# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 8.0.11 5dbe5b6313e1 21 months ago 445MB
为docker创建一个专门放mysql 的文件夹
root@deepin-PC:/etc/docker# cd /opt/
root@deepin-PC:/opt# mkdir mysql_docker
root@deepin-PC:/opt# cd mysql_docker/
root@deepin-PC:/opt/mysql_docker# echo $PWD
/opt/mysql_docker启动mysql容器
docker run --name mysqlserver -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d -i -p 3306:3306 mysql:8.0.11
查看完整容器id
cd /var/lib/docker/containers/
查看启动的容器
root@deepin-PC:/opt/mysql_docker# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1f9aa5b79b6a mysql:latest "docker-entrypoint.s…" About a minute ago Up 59 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp mysql进入mysql(可以用容器id替换mysql)
docker exec -it mysql bash
连接mysql
mysql -u root -p 123456
授予远程访问权限
mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select host,user from user; +-----------+------------------+ | host | user | +-----------+------------------+ | % | root | | localhost | mysql.infoschema | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+------------------+ 5 rows in set (0.00 sec) mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; Query OK, 0 rows affected (0.02 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)查看docker日志:
root@deepin-PC:/opt/mysql_docker# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1f9aa5b79b6a mysql:latest "docker-entrypoint.s…" 6 minutes ago Up 6 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql root@deepin-PC:/opt/mysql_docker# docker logs -f --tail 10 1f9aa5b79b6a 2020-05-11 14:14:30+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up. 2020-05-11T14:14:30.702850Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release. 2020-05-11T14:14:30.702952Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1 2020-05-11T14:14:30.712787Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2020-05-11T14:14:31.064937Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2020-05-11T14:14:31.191792Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060 2020-05-11T14:14:31.284386Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2020-05-11T14:14:31.292565Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2020-05-11T14:14:31.312549Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.一些常用操作
先查看容器的id
docker ps -a
查到id
以下id为容器id
关闭mysql
docker stop id
重启
docker restart id
启动
docker start id
**关闭docker **
systemctl stop docker
重启docker
systemctl restart docker
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新动态
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]