腾讯云centos7.6安装mysql与redis

一 mysql

# 禁用原生mysql
yum module disable mysql
# 删除mariadb
rpm -qa | grep mariadb
rpm -e mariadb-libs --nodeps
# 下载mysql压缩包
mkdir /opt/mysql
cd /opt/mysql/
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar
# 解压并安装
tar -xvf mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar
yum -y install mysql-community-common-*
yum -y install mysql-community-libs-5.7.30-1.el7.x86_64.rpm
yum -y install mysql-community-client-5.7.30-1.el7.x86_64.rpm
yum -y install mysql-community-server-5.7.30-1.el7.x86_64.rpm
# 启动mysql
systemctl start mysqld.service
# 查看初始密码
cat /var/log/mysqld.log |grep password
# 连接mysql,输入初始密码
mysql -u root -p

## mysql界面
# 修改新密码
alter user user() identified by "「新密码」";
# 允许远程登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '「新密码」' WITH GRANT OPTION;
FLUSH PRIVILEGES;

腾讯云放开防火墙即可

二 redis

2.1 服务端

# 下载
mkdir /opt/redis-stack
cd /opt/redis-stack
wget https://packages.redis.io/redis-stack/redis-stack-server-7.0.6-RC8.rhel7.x86_64.tar.gz?_gl=1*zvd770*_ga*NTA1Mjc2MDcxLjE2ODA0OTQxNjE.*_ga_8BKGRQKRPV*MTY4MDUwMjg3MS4yLjEuMTY4MDUwMjkxMS4yMC4wLjA.
tar -zxvf redis-stack-server-7.0.6-RC8.rhel7.x86_64.tar.gz\?_gl\=1\*zvd770\*_ga\*NTA1Mjc2MDcxLjE2ODA0OTQxNjE.\*_ga_8BKGRQKRPV\*MTY4MDUwMjg3MS4yLjEuMTY4MDUwMjkxMS4yMC4wLjA.
cd redis-stack-server-7.0.6-RC8/

# 修改redis-stack配置,开启守护模式,设置密码,.so文件路径改成对应的
vi etc/redis-stack-service.conf:
port 6379
daemonize yes
requirepass 「密码」
loadmodule /opt/redis/redis-stack-server-7.0.6-RC8/lib/redisearch.so
loadmodule /opt/redis/redis-stack-server-7.0.6-RC8/lib/redisgraph.so
loadmodule /opt/redis/redis-stack-server-7.0.6-RC8/lib/redistimeseries.so
loadmodule /opt/redis/redis-stack-server-7.0.6-RC8/lib/rejson.so
loadmodule /opt/redis/redis-stack-server-7.0.6-RC8/lib/redisbloom.so

# 开启服务端
./bin/redis-server etc/redis-stack-service.conf

# 连接
./bin/redis-cli
> info server # 显示信息
> auth 「密码」

2.2 mac redis客户端下载与使用

https://redis.io/download/ 找到macOS对应文件
下载并解压

brew update
brew install openssl@3
./bin/redis-cli -h 43.133.66.10 -p 6379

参考:https://blog.csdn.net/cxy2687365281/article/details/129931785 (不需要make)

posted @ 2024-01-03 17:21  huim  阅读(24)  评论(0编辑  收藏  举报