数据库
首页 > 数据库> > Docker 安装 MySQL

Docker 安装 MySQL

作者:互联网

  1. 查看容器运行情况

    # docker ps
    CONTAINER ID IMAGE          COMMAND          ... PORTS                    NAMES
    4ec4f56455ea c73c7527c03a  "docker-entrypoint.sh" ... 0.0.0.0:3306->3306/tcp   mysql
    Brian

       Brian

      153***2799@qq.com

    5年前 (2017-09-08)
  2.    liaozesong

      lia***song@yeah.net

       参考地址

    313

    docker 安装 mysql 8 版本

    # docker 中下载 mysql
    docker pull mysql
    
    #启动
    docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=Lzslov123! -d mysql
    
    #进入容器
    docker exec -it mysql bash
    
    #登录mysql
    mysql -u root -p
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'Lzslov123!';
    
    #添加远程登录用户
    CREATE USER 'liaozesong'@'%' IDENTIFIED WITH mysql_native_password BY 'Lzslov123!';
    GRANT ALL PRIVILEGES ON *.* TO 'liaozesong'@'%';

标签:Lzslov123,liaozesong,0.0,MySQL,mysql,3306,Docker,安装,docker
来源: https://www.cnblogs.com/bruce1992/p/16534518.html