阿里云CentOS系统环境配置
MySQL
centos安装mysql
- 执行如下命令,更新YUM源。
rpm -Uvh [http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm](http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm?spm=a2c6h.12873639.article-detail.7.5aef255eJYTKv4&file=mysql57-community-release-el7-9.noarch.rpm)
- 执行如下命令,安装MySQL。
yum -y install mysql-community-server --nogpgcheck
- 执行如下命令,查看MySQL版本号。
mysql -V
- 执行如下命令,启动MySQL服务。
systemctl start mysqld
- 执行如下命令,设置MySQL服务开机自启动。
systemctl enable mysqld
- 配置MySQL的root用户密码。执行如下命令,查看/var/log/mysqld.log文件,获取root用户的初始密码。
grep 'temporary password' /var/log/mysqld.log``mysql -uroot -p输入log中密码
-
执行以下命令,修改MySQL的root用户的初始密码。
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678'; -
在MySQL中,密码策略分为四个级别:LOW、MEDIUM、STRONG、默认(默认是MEDIUM)。要将密码策略设置为LOW(只校验密码长度),可以使用以下命令:
SET GLOBAL validate_password.policy = 0; -
设置密码长度要求:
设置密码长度要求,确保密码至少为8位字符。您可以使用以下命令:
SET GLOBAL validate_password.length = 8; -
刷新权限:
刷新MySQL的权限以应用新的密码策略设置:
FLUSH PRIVILEGES;
权限
编辑
Redis
yum安装redis
1.在centos系统上需要安装epel源
wget -O /etc/yum.repos.d/epel.repo mirrors.aliyun.com/repo/epel-7… centos7版本的
2.查看yum仓库redis版本
yum info redis
[root@master ~]# yum info redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name : redis
Arch : x86_64
Version : 3.2.12
Release : 2.el7
Size : 1.4 M
Repo : installed
From repo : epel
Summary : A persistent key-value database
URL : http://redis.io
License : BSD
Description : Redis is an advanced key-value store. It is often referred to as a data
: structure server since keys can contain strings, hashes, lists, sets and
: sorted sets.
:
: You can run atomic operations on these types, like appending to a string;
: incrementing the value in a hash; pushing to a list; computing set
: intersection, union and difference; or getting the member with highest
: ranking in a sorted set.
:
: In order to achieve its outstanding performance, Redis works with an
: in-memory dataset. Depending on your use case, you can persist it either
: by dumping the dataset to disk every once in a while, or by appending
: each command to a log.
:
: Redis also supports trivial-to-setup master-slave replication, with very
: fast non-blocking first synchronization, auto-reconnection on net split
: and so forth.
:
: Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
: limited time-to-live, and configuration settings to make Redis behave like
: a cache.
:
: You can use Redis from most programming languages also.
3.yum安装并开启开机自启
yum install redis systemctl enable --now redis
[root@master ~]# yum install redis
[root@master ~]# systemctl enable --now redis #开启开机自启
4.查看redis是否成功启动
ss -ntl