CentOS7yum安装nginx、mysql


安装nginx

首先更新系统软件

yum update

安装nginx源

yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装nginx

yum install nginx

启动nginx

service nginx start
Redirecting to /bin/systemctl start  nginx.service

访问http://你的ip/

如果成功安装会出来nginx默认的欢迎界面

安装MySQL5.7

安装mysql源

yum localinstall  http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

安装mysql

yum install mysql-community-server

安装mysql的开发包,以后会有用

yum install mysql-community-devel

启动mysql

service mysqld start
#Redirecting to /bin/systemctl start  mysqld.service

查看mysql启动状态

service mysqld status

出现pid,证明启动成功

获取mysql默认生成的密码

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

换成自己的密码

mysql -uroot -p

Enter password:输入上页的密码,进入mysql

更换密码

mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPasdfs4!';

这个密码一定要足够复杂,不然会不让你改,提示密码不合法;

退出mysql并试用下新密码

mysql> quit;
mysql -uroot -p
Last Updated:
Contributors: huangyanfu