1. 下载tar包
1.1. 安装包下载:
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
2. 将mysql安装到/usr/local/mysql下
2.1. 解压tar
-xvf
mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
2.2. 移动mv mysql-5.7.25-linux-glibc2.12-x86_64 /usr/
local/
2.3. 重命名mv /usr/local/mysql-5.7.25-linux-glibc2.12-x86_64 /usr/local/mysql
3. 新建data目录
3.1. mkdir /usr/local/mysq
l/data
4. 新建mysql用户、mysql用户组
4.1. mysql用户组:groupadd mysql
4.2. mysql用户:useradd mysql -g mysql
5. 将/usr/local/mysql的所有者及所属组改为mysql
5.1. chown -R mysql.mysql /usr/
local/mysql
6. 安装mysql
执行命令:
yum install libaio
/usr/local/mysql/bin/mysqld --user=mysql --basedir=
/usr/local/mysql/ --datadir=
/usr/local/mysql/data --initialize
6.1. 编辑/etc/my.cnf
[mysqld]
datadir=/usr/
local/mysql/data
basedir=/usr/
local/mysql
socket=/tmp/mysql.sock
user=mysql
port=3306
character-set-server=utf8
# 取消密码验证
skip-grant-tables
symbolic-links=0
[mysqld_safe]
log-error=/var/
log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
7.1. 开启服务
1.1. 将mysql加入服务
cp /usr/
local/mysql/support-files/mysql.server /etc/init.d/mysql