安装mysql8.0最新版lnmp

1.安装mysql8.0

官方文档:
https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html

下载rpm

yum localinstall http://mirrors.ustc.edu.cn/mysql-repo/mysql80-community-release-el7-3.noarch.rpm

安装rpm

yum install mysql-community-server

启动mysql服务端

service mysqld start

查找初始密码

一定要先启动mysqld服务,不然不会生成初始密码:

sudo grep 'temporary password' /var/log/mysqld.log

设置新密码,否则不让登录

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'MyNewPass4!ysp123456';
增加用户,赋予权限
# 注意mysql_native_password 加密方式,否则使用phpmyadmin会碰到问题 https://blog.csdn.net/zhezhebie/article/details/106289214
# 以前一步执行的创建用户分配权限,现在分为两步

create user 'ysp'@'%' identified WITH mysql_native_password by 'Ysp123456!';

grant all privileges on *.* to ysp@'%';

flush privileges;

其他镜像源:
http://mirrors.ustc.edu.cn/mysql-repo/yum/mysql-8.0-community/el/7/x86_64/

2.安装nginx:

yum localinstall http://mirrors.ustc.edu.cn/nginx/centos/7/x86_64/RPMS/nginx-1.18.0-1.el7.ngx.x86_64.rpm

查看nginx版本

nginx -v

3.安装php:

安装yum源

yum install epel-release

安装php源

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

安装php拓展

yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json 
php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo 
php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-soap php73-php-pecl-zip
php73-php-process php73-php-pecl-yaf php73-php-xml php73-php-pecl-swoole4

设置开机启动

systemctl enable php73-php-fpm
systemctl start php73-php-fpm

查看php版本

php73 -v

举个例子,你要安装其他拓展,例如看看有没有swoole的拓展:

yum search swoole #找到了下面这个拓展,那么就可以直接安装了
yum install -y php73-php-pecl-swoole4.x86_64
php73 -m |grep swoole
cp /usr/bin/php73 /usr/bin/php  #后续就可以直接使用php -m

可以看到swoole已经被安装好了。

4.安装redis最新版本:

sudo yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
sudo yum --enablerepo=remi install redis -y
systemctl start redis

设置服务开机启动

systemctl enable mysqld
systemctl start mysqld
systemctl enable php73-php-fpm
systemctl start php73-php-fpm
systemctl enable nginx
systemctl enable redis

5.查看已经开机启动的服务:

systemctl list-unit-files |grep enabled

在这里插入图片描述

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读