Centos学习笔记(四)常用服务配置
一、Nginx配置
一、虚拟主机配置
1、配置文件
在nginx/nginx.conf文件里引入nginx/conf.d/*.conf

新建conf.d/myNgnix.conf文件

添加内容

2、修改hosts文件


3、 在本地windows电脑中修改host文件: c:\windows\system32\drivers\etc\hosts,增加一行

4、验证

二、伪静态的实现
1、增加一行rewrite

2、验证

三、反向代理

四、负载均衡


二、MySQL配置(5.8版本,与5.7些许命令不一致)
先设置开机启动:sudo chkconfig mysqld on
1、获取默认密码

2、登陆
mysql -uroot -pWAJ.nzlqkxdg
3、修改密码
修改密码规则:
1.set global validate_password.policy=0;
2.set global validate_password.length=1;
修改密码:alter user user() identified by '123456';
4、远程连接
use mysql;
select host,user from user where user='root'; # 查看host,正常情况,host=localhost
update user set host='%' where user='root' and host='localhost'; #更改用户名为root的账户,host为所有ip
select host,user from user where user='root'; # 查看更改,此时 host=%FLUSH PRIVILEGES;
navicat连接:mysql8问题描述:
Error: 1251
Message: Client does not support authentication protocol requested by server; consider upgrading MySQL client
解决:
USE mysql;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的数据库密码';
FLUSH PRIVILEGES;
浙公网安备 33010602011771号