1、安装基础组件
yum -y install make gcc-c++ cmake bison-devel ncurses-
devel libaio libaio-devel numactl.x86_64
2、新建用户mysql,并添加到用户组mysql下
groupadd mysql
useradd mysql -g mysql
3、下载mysql到tar包
5.7/mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
4、解压后,重新命名
mv mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz /opt
cd /opt/
mv mysql-5.7.20-linux-glibc2.12-x86_64 /usr/local/mysql
5、新建数据存储目录,并更改mysql文件夹到归宿用户和用户组mysql
mkdir /usr/local/data
cd /usr/local
chown -R mysql:mysql mysql/
6、修改mysql到权限
cd mysql
chmod -R 755 mysql/
7、开始初始化安装mysql
/usr/local/mysql/bin/mysqld --initialize --user=mysql
--datadir=/usr/local/mysql/data --
basedir=/usr/local/mysql
8、安装好后做一些软链接
ln -s /usr/local/mysql/support-files/mysql.server
/etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin
ln -s /usr/local/mysql/mysqld.sock /tmp/mysql.sock
9、修改一下/etc/my.cnf,后启动(centos7系统)
systemctl enable mysql.service
systemctl start mysql.service
service mysql start