二、数据库安装
时间:2022-03-15 08:30
Mysql数据库(这里是5.6版本)
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql mysql-server -y
安装完成,初始密码为空
启动mysql服务
systemctl start mysqld
停止mysql服务
systemctl stop mysqld
重启mysql服务
systemctl restart mysqld
登录mysql
mysql -u root -p
输入密码登录
修改密码:
use mysql;
UPDATE user SET Password = PASSWORD(‘newpassword‘) WHERE user = ‘root‘;
FLUSH PRIVILEGES;
MongoDB数据库(这里是3.4)
添加MongoDB源
vim /etc/yum.repos.d/mongodb-org.repo
写入内容保存
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
执行命令安装
yum install mongodb-org
启动mongodb命令
systemctl start mongod
停止命令
systemctl stop mongod
重新加载
systemctl reload mongodb
Redis安装
添加EPEL仓库
yum install epel-release
更新yum源
yum update
安装redis
yum -y install redis
启动redis服务
systemctl start redis
redis命令行操作模式:
redis-cli
重启、停止同上