您的位置:首页 > 运维架构 > Linux

centos7安装MYsql5.7 64位

qq_42722944 2020-05-05 12:16 211 查看 https://blog.csdn.net/qq_42722

第一步

在MySQL官网中下载YUM源rpm安装包:http://dev.mysql.com/downloads/repo/yum/

第二步

# 下载mysql源安装包

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

# 安装mysql源

shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm

 

检查mysql源是否安装成功

1

 yum repolist enabled | grep
"mysql.*-community.*"

第三步安装

yum install mysql-community-server

第四步启动

ystemctl start mysqld

 

第五步设置开机启动

systemctl
enable
mysqld

systemctldaemon-reload

第六步修改密码

mysql会有一个默认密码用命令:

sudo grep 'temporary password' /var/log/mysqld.log

[code]grep 'temporary password' /var/log/mysqld.log
[code]mysql -uroot -p
[code]ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

或者

[code]set password for 'root'@'localhost'=password('MyNewPass4!');

 

(二)、安装redis

第一步:下载redis安装包

wget http://download.redis.io/releases/redis-4.0.6.tar.gz

[root@iZwz991stxdwj560bfmadtZ local]# wget http://download.redis.io/releases/redis-4.0.6.tar.gz
--2017-12-13 12:35:12--  http://download.redis.io/releases/redis-4.0.6.tar.gz
Resolving download.redis.io (download.redis.io)... 109.74.203.151
Connecting to download.redis.io (download.redis.io)|109.74.203.151|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1723533 (1.6M) [application/x-gzip]
Saving to: ‘redis-4.0.6.tar.gz’

100%[==========================================================================================================>] 1,723,533    608KB/s   in 2.8s

2017-12-13 12:35:15 (608 KB/s) - ‘redis-4.0.6.tar.gz’ saved [1723533/1723533]

 

第二步:解压压缩包

tar -zxvf redis-4.0.6.tar.gz

[root@iZwz991stxdwj560bfmadtZ local]# tar -zxvf redis-4.0.6.tar.gz

 

第三步:yum安装gcc依赖

yum install gcc

[root@iZwz991stxdwj560bfmadtZ local]# yum install gcc

遇到选择,输入y即可

1

 

第四步:跳转到redis解压目录下

cd redis-4.0.6

[root@iZwz991stxdwj560bfmadtZ local]# cd redis-4.0.6

 

第五步:编译安装

make MALLOC=libc  

[root@iZwz991stxdwj560bfmadtZ redis-4.0.6]# make MALLOC=libc

 

将/usr/local/redis-4.0.6/src目录下的文件加到/usr/local/bin目录

cd src && make install

 

[root@iZwz991stxdwj560bfmadtZ redis-4.0.6]# cd src && make install
CC Makefile.dep

Hint: It's a good idea to run 'make test' ;)

INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install

 

 

二、启动redis的三种方式

 

先切换到redis src目录下

[root@iZwz991stxdwj560bfmadtZ redis-4.0.6]# cd src

 

1、直接启动redis

./redis-server

[root@iZwz991stxdwj560bfmadtZ src]# ./redis-server
18685:C 13 Dec 12:56:12.507 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
18685:C 13 Dec 12:56:12.507 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=18685, just started
18685:C 13 Dec 12:56:12.507 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-``    `.  `_.  ''-._           Redis 4.0.6 (00000000/0) 64 bit
.-`` .-```.  ```\/    _.,_ ''-._
(    '      ,       .-`  | `,    )     Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
|    `-._   `._    /     _.-'    |     PID: 18685
`-._    `-._  `-./  _.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |           http://redis.io
`-._    `-._`-.__.-'_.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |
`-._    `-._`-.__.-'_.-'    _.-'
`-._    `-.__.-'    _.-'
`-._        _.-'
`-.__.-'

18685:M 13 Dec 12:56:12.508 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
18685:M 13 Dec 12:56:12.508 # Server initialized
18685:M 13 Dec 12:56:12.508 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
18685:M 13 Dec 12:56:12.508 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
18685:M 13 Dec 12:56:12.508 * Ready to accept connections  

 

烤火的猫 原创文章 36获赞 0访问量 703 关注 私信
标签: