mysql进阶(上)
文章目录
1. 二进制安装mysql
//下载二进制格式的mysql软件包
[root@150 ~]# cd /usr/src
[root@150 src]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
--2022-07-26 18:25:40-- https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
Resolving downloads.mysql.com (downloads.mysql.com)... 23.76.76.109, 2402:4f00:4002:194::2e31, 2402:4f00:4002:182::2e31
Connecting to downloads.mysql.com (downloads.mysql.com)|23.76.76.109|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz [following]
--2022-07-26 18:25:41-- https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
Resolving cdn.mysql.com (cdn.mysql.com)... 23.194.211.12
Connecting to cdn.mysql.com (cdn.mysql.com)|23.194.211.12|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 674830866 (644M) [application/x-tar-gz]
Saving to: ‘mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz’
mysql-5.7.38-linux-glibc2.12-x86_64.tar.g 100%[===================================================================================>] 643.57M 28.3MB/s in 25s
2022-07-26 18:26:07 (25.3 MB/s) - ‘mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz’ saved [674830866/674830866]
[root@150 src]# ls
annobin debug kernels mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz mysql57-community-release-el7-11.noarch.rpm
[root@150 src]#
//创建用户和组
[root@150 src]# groupadd -r mysql
[root@150 src]# useradd -M -r -s /sbin/nologin -g mysql mysql
[root@150 src]# id mysql
uid=299(mysql) gid=299(mysql) groups=299(mysql)
[root@150 src]#
//解压软件至/usr/local/
[root@150 src]# tar xf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@150 src]# ls /usr/local
apache apr apr-until bin etc games include lib lib64 libexec mysql-5.7.38-linux-glibc2.12-x86_64 nginx sbin share src
[root@150 src]# cd /usr/local/
[root@150 local]#
[root@150 local]#
[root@150 local]# ln -sv mysql-5.7.38-linux-glibc2.12-x86_64/ mysql
'mysql' -> 'mysql-5.7.38-linux-glibc2.12-x86_64/'
[root@150 local]# ll
total 0
drwxr-xr-x. 14 root root 164 Jul 14 18:59 apache
drwxr-xr-x. 6 root root 58 Jul 14 18:49 apr
drwxr-xr-x. 5 root root 43 Jul 14 18:54 apr-until
drwxr-xr-x. 2 root root 6 Jun 22 2021 bin
drwxr-xr-x. 2 root root 6 Jun 22 2021 etc
drwxr-xr-x. 2 root root 6 Jun 22 2021 games
drwxr-xr-x. 2 root root 6 Jun 22 2021 include
drwxr-xr-x. 2 root root 6 Jun 22 2021 lib
drwxr-xr-x. 3 root root 17 Jun 27 14:18 lib64
drwxr-xr-x. 2 root root 6 Jun 22 2021 libexec
lrwxrwxrwx. 1 root root 36 Jul 26 18:36 mysql -> mysql-5.7.38-linux-glibc2.12-x86_64/
drwxr-xr-x. 9 root root 129 Jul 26 18:33 mysql-5.7.38-linux-glibc2.12-x86_64
drwxr-xr-x. 11 root root 164 Jul 14 16:31 nginx
drwxr-xr-x. 2 root root 6 Jun 22 2021 sbin
drwxr-xr-x. 5 root root 49 Jun 27 14:18 share
drwxr-xr-x. 2 root root 6 Jun 22 2021 src
[root@150 local]#