Redis优化MySQL.
MySQL+NoSQL(Redis)
1.安装gcc*
安装所需要的包(有包上传即可)
$ yum -y install *
配置网站nginx 并启动nginx
$ vim /etc/nginx/nginx.conf
$ vim /etc/nginx/conf.d/default.conf
启动nginx
$ nginx -t nginx
$ vim /etc/php-fpm.d/www.conf
启动php和数据库
授权,使登录数据库时使用‘123456’密码
测试网站和php的连通性
$ vim /usr/share/nginx/html/info.php
以上搭建了一个lnmp环境.
安装redis
安装提供php和redis联系的软件
解压
安装
让php支持redis
$ vim /etc/php.ini
进入mysql插数据
$ mysql -uroot -p123456
开启redis,并编写脚本
将脚本放在/usr/share/nginx/html/下。
关闭 、/usr/local/redis/bin/redis-cli -a123456 shotdown
$ vim /usr/local/redis/etc/redis.conf修改将requirepass 123456 注释掉
验证php访问redis 和 mysql
ip/脚本名
注:本文为博主查阅多方资料整理而成,如有侵权请留言联系博主删除。
学习新东西,不要忘记复习旧知识,这样你才能更好!