• 请不要在回答技术问题时复制粘贴 AI 生成的内容
gouchaoer
V2EX  ›  程序员

在 docker 里面用 centos7 怎么安装 mysql5.7?

  •  
  •   gouchaoer · Dec 4, 2017 · 1940 views
    This topic created in 3098 days ago, the information mentioned may be changed or developed.
    首先下载安装 mysql 官方的源,但是安装的时候需要交互,这个在 centos 下怎么搞?
    1 replies    2017-12-22 10:11:15 +08:00
    gouchaoer
        1
    gouchaoer  
    OP
       Dec 22, 2017
    RUN yum -y install http://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
    RUN yum install -y mysql-community-server
    RUN /etc/init.d/mysqld start \
    && password=$(cat /var/log/mysqld.log | grep "A temporary password is generated for" | tail -1 | sed -n 's/.*root@localhost: //p') \
    && newPassword="Phpdish-2017" \
    && mysql -uroot -p$password -Bse "ALTER USER 'root'@'localhost' IDENTIFIED BY '$newPassword';" --connect-expired-password \
    && mysql -pPhpdish-2017 -e"create database symfony default character set utf8mb4 collate utf8mb4_unicode_ci;" \
    && /etc/init.d/mysqld stop
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1038 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 23:09 · PVG 07:09 · LAX 16:09 · JFK 19:09
    ♥ Do have faith in what you're doing.