1. 配置mysql的YUM源
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2. 安装mysql源
yum localinstall -y mysql57-community-release-el7-8.noarch.rpm
3. 检查mysql源是否安装成功
yum repolist enabled | grep "mysql.*-community.*"
4. 安装MySQL
yum -y install mysql-community-server
5. 启动mysql
systemctl start mysqld
6. 设置mysql开机启动
systemctl enable mysqld
systemctl daemon-reload
7. 修改root默认密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
或
set password for 'root'@'localhost'=password('MyNewPass4!');
注意:mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误
刷新数据:
FLUSH PRIVILEGES;
或者退出mysql重启服务:
quit
systemctl restart mysqld.service;
8. 设置mysql远程连接
mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyNewPass4!' WITH GRANT OPTION;
quit
9. 关闭防火墙
systemctl stop firewalld.service
禁止开机启动
systemctl disable firewalld.service
10.安装apache和php
yum install -y httpd php php-mysql
11.安装Apache扩展包
yum install -y httpd-manual mod_ssl mod_perl mod_auth_mysql
12.安装PHP扩展包
yum install -y php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel
13.安装Mysql扩展包
yum install -y mysql-connector-odbc mysql-devel libdbi-dbd-mysql
14.配置Apache、mysql开机启动
systemctl enable httpd.service
systemctl enable mysqld.service
15.在/var/www/html目录下建立Index.php文件测试文件,代码
16.完成安装,上传discuz系统到/var/www/html,这里以Discuz!X3.2 简体中文 UTF8 版为例
17.上传成功后发现所有的目录都是不可写的,这是因为当前web目录没有权限并且linux7系统使用了selinux的原因
给当前web目录设置权限
chmod -R 777 ./
修改 /etc/selinux/config 文件中的 SELINUX="" 为 disabled ,然后重启。