Centos 7 Yum 安装Mysql

环境Centos 7 

1.更新系统 

yum -y install epel-release
yum clean all
yum makecache
yum -y update

2.安装给组件

yum install -y lrzsz ntpdate sysstat  wget vim net-tools

3.安装Yum Mysql 源

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

sudo yum -y localinstall mysql57-community-release-el7-9.noarch.rpm  sudo yum -y install mysql-community-server sudo systemctl restart mysqld sudo grep ‘temporary password‘ /var/log/mysqld.log

 4.更换数据目录


sudo systemctl stop mysqld
sudo mkdir -p /home/mydata/mysql
sudo chown mysql:mysql -R /home/mydata/mysql
sudo mv /var/lib/mysql/* /home/mydata/mysql
sudo ln -s /home/mydata/mysql/mysql.sock /var/lib/mysql/mysql.sock

5.更换数据目录配置

sudo vim /etc/my.cnf
#调整配置如下
datadir=/home/mydata/mysql/
socket=/home/mydata/mysql/mysql.sock

6.最后重启服务

sudo systemctl restart mysqld

 

Centos 7 Yum 安装Mysql

上一篇:Mysql-3 正则表达式


下一篇:oracle存储过程--流程控制(条件判断和循环遍历)