1.创建软件目录,方便管理
[root@wp-centos /root]# mkdir /software && cd /software
2.下载安装包
[root@wp-centos /software]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.20-el7-x86_64.tar.gz
3.解压安装包
[root@wp-centos /software]# tar xf mysql-8.0.20-el7-x86_64.tar.gz
4.创建软连接
[root@wp-centos /software]# ln -s /software/mysql-8.0.20-el7-x86_64 /usr/local/mysql
5.卸载系统自带mariadb
[root@wp-centos /software]# yum remove -y mariadb-libs
6.添加mysql用户
[root@wp-centos /software]# useradd mysql -M -s /sbin/nologin
7.创建数据目录并授权给mysql用户
[root@wp-centos /software]# mkdir /data/mysql/data -p
[root@wp-centos /software]# chown -R mysql.mysql /data
8.编辑配置文件
[root@wp-centos /software]# vim /etc/my.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/data/mysql/data
socket=/data/mysql/mysql.sock
port=3306
[mysql]
socket=/data/mysql/mysql.sock
prompt=[\\u@\\h \\d]>\_
9.添加环境变量
[root@wp-centos /software]# vim /etc/profile
export PATH=/usr/local/mysql/bin:$PATH
[root@wp-centos /software]# source /etc/profile
10.安装mysql所需依赖包
[root@wp-centos /software]# yum install -y libaio-devel
11.初始化数据
[root@wp-centos /software]# mysqld --defaults-file=/etc/my.cnf --initialize-insecure
12.配置启动脚本并启动mysql
[root@wp-centos /software]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@wp-centos /software]# /etc/init.d/mysqld start
13.查看mysql进程
[root@wp-centos /software]# ps -ef|grep mysqld
标签:8.0,20,centos,data,MySQL,mysql,root,wp,software
From: https://www.cnblogs.com/log4g/p/17406487.html