基于centos基础镜像构建mysql 镜像

基于centos基础镜像构建mysql 镜像,第1张

版本:mysql-5.6.51 源码安装

https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.51.tar.gz

docker build -t 镜像名称:镜像版本 . -f Dockerfile文件

docker run -p 3306:3306 --name mysql -d 镜像名称:镜像版本

1 进入到myql虚拟机中:docker exec -it 容器id /bin/bash

2 进入mysql: mysql -u root -p (第一次进入mysql 是没有密码的)

3 授权 *** 作: grant all privileges on . to 'root'@'%' identified by '123456'

grant all privileges on . to 'root'@'localhost' identified by '123456'

4 刷新授权: flush privileges

linux安装mysql没有可用镜像可以这样 *** 作

1、查看可用的MySQL版本

2、拉取MySQL镜像

3、查看本地镜像

4、运行容器

5、连接MySql,访问MySQL服务安装成功。

1、输入“python3 install pymysql",报错

2、后来使用国内镜像源,还是报错,无法安装。

    pip3 install 库名 -i 镜像源地址

    例如:pip3 install pymysql -i  https://pypi.tuna.tsinghua.edu.cn/simple

    镜像源地址

    清华: https://pypi.tuna.tsinghua.edu.cn/simple

    豆瓣: http://pypi.douban.com/simple/

    阿里: http://mirrors.aliyun.com/pypi/simple/

3、经网上查询,需使用”--trusted-host  pypi.tuna.tsinghua.edu.cn ",可安装成功。

即:pip install 库名 -i 镜像源地址 --trusted-host  pypi.tuna.tsinghua.edu.cn

例如:pip3 install pymysql -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

4、验证pymysql是否安装成功。

>>>import pymysql   不报错就行。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/7424574.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-05
下一篇 2023-04-05

发表评论

登录后才能评论

评论列表(0条)

保存