欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

CentOS7服務(wù)器中apache、php7以及mysql5.7的安裝配置代碼

 更新時(shí)間:2017年10月11日 11:11:24   投稿:mrr  
這篇文章主要介紹了CentOS7服務(wù)器中apache、php7以及mysql5.7的安裝配置代碼,需要的朋友可以參考下

CentOS7服務(wù)器中apache、php7以及mysql5.7的配置代碼如下所示:

yum upgrade
yum install net-tools

安裝apache

關(guān)閉SELinux
編輯器打開 etc/selinux/config 文件,找到 SELINUX=enforcing 字段,將其改成 SELINUX=disabled ,并重啟設(shè)備。
yum -y install httpd mod_ssl
配置防火墻
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --reload
開機(jī)啟動(dòng)
systemctl start httpd
systemctl enable httpd
終端輸入如下指令檢查httpd的運(yùn)行狀態(tài)
sudo systemctl status httpd

安裝PHP7

添加源
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 install php70w

安裝mysql5.7

1.安裝wget
  yum -y install wget
2.安裝源
  wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
  rpm -ivh mysql57-community-release-el7-8.noarch.rpm
3.安裝mysql
  yum install mysql-server
4.啟動(dòng)mysql服務(wù)
  systemctl start mysqld
5.查看MySQL的啟動(dòng)狀態(tài)
  systemctl status mysqld
6.開機(jī)啟動(dòng)
  systemctl enable mysqld
  systemctl daemon-reload
7.修改root本地登錄密碼
  查找mysql生成的隨機(jī)密碼
  grep 'temporary password' /var/log/mysqld.log
  mysql -uroot -p
  修改密碼,注意:mysql5.7默認(rèn)安裝了密碼安全檢查插件(validate_password),默認(rèn)密碼檢查策略要求密碼必須包含:大小寫字母、數(shù)字和特殊符號(hào),并且長度不能少于8位。否則會(huì)提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements錯(cuò)誤
  ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; 
8.配置默認(rèn)編碼為utf8
  修改/etc/my.cnf配置文件,在[mysqld]下添加編碼配置
  [mysqld]
  character_set_server=utf8
  init_connect='SET NAMES utf8'
9.配置mysql遠(yuǎn)程連接
  mysql -uroot -p
  use mysql;
  Grant all on *.* to 'root'@'%' identified by 'root用戶的密碼' with grant option;
flush privileges;
然后用以下命令查看哪些用戶和host可以訪問,%代表任意ip地址
select user,host from user;
防火墻添加3306端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
10.mysql忘記密碼
1.修改MySQL的配置文件(默認(rèn)為/etc/my.cnf),在[mysqld]下添加一行skip-grant-tables
2.service mysqld restart后,即可直接用mysql進(jìn)入
3.mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
  mysql> flush privileges;
  mysql> quit;
 將/etc/my.cnf文件還原,重新啟動(dòng)mysql:service mysql restart,這個(gè)時(shí)候可以使用mysql -u root -p'123qwe'進(jìn)入了
 mysql>SET PASSWORD = PASSWORD('newpasswd'); 設(shè)置新密碼

總結(jié)

以上所述是小編給大家介紹的CentOS7服務(wù)器中apache、php7以及mysql5.7的安裝配置代碼,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論