mysql二进制安装5.7.38
//
# mysql二进制安装
- 安装基础工具包
yum install -y curl gcc bison-devel openssl-devel bison libaio-devel cmake
# 创建用户
id mysql
if [ $? -ne 0 ];then
useradd mysql -s /sbin/nologin -M
fi
1
2
3
4
2
3
4
# 下载安装包
mkdir /data/
cd /data
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
#解压
tar xf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
1
2
3
4
5
6
2
3
4
5
6
# 生成、配置
- 5.7
Dir=/data
mkdir -p /data/mysql
cd /data/mysql
[ -d ${Dir} ]||mkdir ${Dir}
[ -d ${Dir}/mysql/data ] || mkdir -p ${Dir}/mysql/data
[ -d ${Dir}/mysql/var ] || mkdir -p ${Dir}/mysql/var
[ -d ${Dir}/mysql/tmp ] || mkdir -p ${Dir}/mysql/tmp
[ -d ${Dir}/mysql/logs/innodblog ] || mkdir -p ${Dir}/mysql/logs/innodblog
> ${Dir}/mysql/logs/mysql-error.log
#拷贝二进制文件
cp -a /data/mysql-5.7.38-linux-glibc2.12-x86_64/bin /data/mysql/bin
export LD_LIBRARY_PATH=/data/soft/mysql-8.0.32-el7-x86_64/lib/private/
#初始化
/data/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=${Dir}/mysql/ --datadir=${Dir}/mysql/data --tmpdir=${Dir}/mysql/tmp
#授权
chown -R mysql.mysql ${Dir}/mysql/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- 8.0
#mysql8默认区分大小写,只有初始化时可以设置
./mysqld --initialize--user=mysgl --lower-case-table-names=1
1
2
3
4
2
3
4
# 生成启动配置文件
cat >>/usr/lib/systemd/system/mysqld.service<<OPO
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://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=${Dir}/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
OPO
#启动
systemctl daemon-reload
systemctl enable mysqld
systemctl start mysqld
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 防火墙开启白名单
firewall-cmd --add-source=192.168.248.0/24 --zone=trusted firewall-cmd --add-source=192.168.248.0/24 --zone=trusted --permanent
//
如果此文章对您有帮助,点击 -->> 请博主喝咖啡 (opens new window)
上次更新: 2024/09/27, 18:00:01