centos下安装Mysql和redis数据库

Mysql的安装

-------------------------------------------------------------------------------------------------------------------------

先安装wget

命令行为:yum install wget

1)前往用户根目录

>: cd ~

2)下载mysql57

>: wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

3)安装mysql57

>: yum -y install mysql57-community-release-el7-10.noarch.rpm
>: yum -y install mysql-community-server

4)启动mysql57并查看启动状态

>: systemctl start mysqld.service
>: systemctl status mysqld.service

5)查看默认密码并登录

>: grep "password" /var/log/mysqld.log
>: mysql -uroot -p

6)修改密码

>: ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

 

 

 

 

Redis的安装

---------------------------------------------------------------------------------------------------------------------------

1)前往用户根目录
>: cd ~
2)下载redis-5.0.5
>: wget http://download.redis.io/releases/redis-5.0.5.tar.gz
3)解压安装包
>: tar -xf redis-5.0.5.tar.gz
4)进入目标文件
>: cd redis-5.0.5
5)编译环境
>: make
6)复制环境到指定路径完成安装
>: cp -r ~/redis-5.0.5 /usr/local/redis
7)配置redis可以后台启动:修改下方内容
>: vim /usr/local/redis/redis.conf
daemonize yes
8)完成配置修改
>: esc
>: :wq
​
9)建立软连接
>: ln -s /usr/local/redis/src/redis-server /usr/bin/redis-server
>: ln -s /usr/local/redis/src/redis-cli /usr/bin/redis-cli
10)后台运行redis
>: redis-server &
ctrl + c
11)测试redis环境
>: redis-cli
ctrl + c
12)关闭redis服务
>: pkill -f redis -9

 

posted @ 2019-07-23 21:10  不忘初心❤  阅读(365)  评论(0编辑  收藏  举报