二进制安装mysql

本文档详细介绍了如何在CentOS系统中配置阿里云YUM源,包括Base、Extras、Plus、PowerTools和AppStream等仓库,并展示了安装MySQL的过程,包括解压、创建软连接、设置权限、初始化数据库、配置my.cnf文件、启动服务以及添加环境变量。此外,还提到了解决依赖问题和修改MySQL root用户密码的方法。
摘要由CSDN通过智能技术生成

一配置yum源
1 cd /mnt/cdrom
2 cd /etc/yum.repos.d/
3 vi redhat.repo
4 yum clean all
5 yum makecache
6 yum repolist
[base]
name=CentOS- r e l e a s e v e r − B a s e − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p s : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos/ releaseverBasemirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos/releasever/BaseOS/ b a s e a r c h / o s / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.aliyuncs.com/centos/ basearch/os/http://mirrors.aliyuncs.com/centos/releasever/BaseOS/ b a s e a r c h / o s / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/os/http://mirrors.cloud.aliyuncs.com/centos/releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

[extras]
name=CentOS- r e l e a s e v e r − E x t r a s − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p s : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos/ releaseverExtrasmirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos/releasever/extras/ b a s e a r c h / o s / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.aliyuncs.com/centos/ basearch/os/http://mirrors.aliyuncs.com/centos/releasever/extras/ b a s e a r c h / o s / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/os/http://mirrors.cloud.aliyuncs.com/centos/releasever/extras/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

[centosplus]
name=CentOS- r e l e a s e v e r − P l u s − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p s : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - Plus - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos/ releaseverPlusmirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos/releasever/centosplus/ b a s e a r c h / o s / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.aliyuncs.com/centos/ basearch/os/http://mirrors.aliyuncs.com/centos/releasever/centosplus/ b a s e a r c h / o s / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/os/http://mirrors.cloud.aliyuncs.com/centos/releasever/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

[PowerTools]
name=CentOS- r e l e a s e v e r − P o w e r T o o l s − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p s : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - PowerTools - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos/ releaseverPowerToolsmirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos/releasever/PowerTools/ b a s e a r c h / o s / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.aliyuncs.com/centos/ basearch/os/http://mirrors.aliyuncs.com/centos/releasever/PowerTools/ b a s e a r c h / o s / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/os/http://mirrors.cloud.aliyuncs.com/centos/releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

[AppStream]
name=CentOS- r e l e a s e v e r − A p p S t r e a m − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p s : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - AppStream - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos/ releaseverAppStreammirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.aliyun.com/centos/releasever/AppStream/ b a s e a r c h / o s / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.aliyuncs.com/centos/ basearch/os/http://mirrors.aliyuncs.com/centos/releasever/AppStream/ b a s e a r c h / o s / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/os/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/os/http://mirrors.cloud.aliyuncs.com/centos/releasever/AppStream/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

在这里插入图片描述

将MySQL数据包放入

在这里插入图片描述
把数据包放到主目录里面并且配置mysql数据组

[root@localhost ~] cd /usr/local/
[root@localhost local] tar xf mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
[root@localhost local] ln -sv mysql-5.7.14-linux-glibc2.5-x86_64 mysql  #创建软连接,方便之后操作
[root@localhost local] chown -R mysql.mysql mysql/*
初始化命令:
mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
====注意记录临时密码

解压文件并创建快捷方式

[root@localhost local] cd /usr/local/mysql
[root@localhost mysql] \cp support-files/my-default.cnf /etc/my.cnf

为mysql配置主文件
vim /etc/my.cnf

添加如下行指定mysql数据文件的存放位置:

datadir = /usr/local/mysql/data

[root@localhost mysql] cp support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@localhost mysql] chmod +x /etc/rc.d/init.d/mysqld
1

启动mysql

chkconfig --add mysqld --添加为系统服务
chkconfig mysqld on --开机自启动
systemctl start mysqld

将mysql的bin目录加入PATH环境变量,编辑/etc/profile文件

cd /etc/profile.d/
vim mysql.sh

• 添加如下内容
export PATH=$PATH:/usr/local/mysql/bin
之后
source mysql.sh启用环境变量

sudo ln -s 文件路径 快捷方式路径
sudo ln -s /usr/lib64/libncurses.so.6.1 /usr/lib64/libncurses.so.5
这样就在/usr/lib64下建立了一个libncurses.so.5的快捷方式。mysql在启动时就会寻找该libncurses.so.5依赖的快捷方式,最后实际链接到了libncurses.so.6.1依赖。
mysql -u root -p 登录,输入之前记录的随机密码
========进入MySQL终端:
修改密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘root’

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值