二进制安装mysql 5.7

1.关闭防火墙
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld

2.配置网卡
cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vi ifcfg-ens33
systemctl status network
systemctl restart network

3.下载mysql
mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz

4.新建放软件地址
mkdir -p /server/tools
cd /server/tools

5.解压mysql
rz
tar -zxvf mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz

6.创建数据库目录
mkdir /application
mv mysql-5.7.14-linux-glibc2.5-x86_64 /application/mysql

7.创建用户
useradd -s /sbin/nologin mysql

8.修改环境变量
vim /etc/profile
export PATH=/application/mysql/bin:$PATH
source /etc/profile
mysql -V

9.添加一块磁盘 sdb 模拟数据盘
格式化并挂载磁盘
mkfs.xfs /dev/sdb
fdisk -l
mkdir /data
blkid
vim /etc/fstab
UUID="LBOaHo-H7m5-gL53-IDIH-9ucY-PTo7-l1sCt6" /data xfs defaults 0 0
mount -a
df -h

10.授权
chown -R mysql.mysql /application/*
chown -R mysql.mysql /data/mysql/data

11.初始化数据
mkdir -p /data/mysql/data
mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/data/mysql/data

无密码
mysqld --initialize-insecure --user=mysql --basedir=/application/mysql --datadir=/data/mysql/data

管理员密码设置
mysqladmin -uroot -p password 123

12.配置 vi/etc/my.cnf
[mysqld]
user=mysql
basedir=/application/mysql
datadir=/data/mysql/data
socket=/tmp/mysql.sock
server_id=6
port=3306
[mysql]
socket=/tmp/mysql.sock

13.启动数据库
13.1 sys -v
cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld

service mysqld start

13.2 systemctl

vi /etc/systemd/system/mysqld.service

[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000

systemctl start mysqld

二进制安装mysql 5.7

上一篇:一键部署----mysql5.6--jue


下一篇:Oracle RMAN block_change_tracking(块更改追踪)