美文网首页
centos7安装apache、php7.2、mysql

centos7安装apache、php7.2、mysql

作者: 韩小禹 | 来源:发表于2019-08-28 22:37 被阅读0次
    安装httpd(apache)

    安装命令:yum install -y httpd
    启动命令:systemctl start httpd.service

    安装PHP7.2

    更新yum源:
    rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

    安装命令:
    yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

    检测是否成功:php -v
    查看php拓展:php -m

    安装mysql

    下载官方Repository:wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

    安装Repository:yum -y install mysql57-community-release-el7-10.noarch.rpm

    安装MySQL服务器:yum -y install mysql-community-server

    启动mysql:systemctl start mysqld.service

    查看mysql状态:systemctl status mysqld.service

    此时MySQL已经开始正常运行,但是要想进入MySQL需要先找出此时root的初始密码,通过如下命令可以在日志文件中找出密码:
    grep "password" /var/log/mysqld.log
    结果如下:
    2019-08-25T15:41:59.182937Z 1 [Note] A temporary password is generated for root@localhost: AmuX<tMcD2Df
    AmuX<tMcD2Df就是此时root用户的密码。

    登录mysql:mysql -uroot -p ,回车,然后输入刚才得到的密码。

    登录mysql后修改初始密码:ALTER USER 'root'@'localhost' IDENTIFIED BY '123123';

    如果出现错误:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
    解决方法:
    1:set global validate_password_policy=0;
    2:set global validate_password_length=1;
    3:ALTER USER 'root'@'localhost' IDENTIFIED BY '123123';

    相关文章

      网友评论

          本文标题:centos7安装apache、php7.2、mysql

          本文链接:https://www.haomeiwen.com/subject/hgyvectx.html