当前位置:网站首页>Tutorial on principles and applications of database system (006) -- compiling and installing MySQL 5.7 (Linux Environment)
Tutorial on principles and applications of database system (006) -- compiling and installing MySQL 5.7 (Linux Environment)
2022-07-01 16:19:00 【Rsda DBA_ WGX】
Database system principle and Application Tutorial (006)—— Compilation and installation MySQL5.7(Linux Environmental Science )
Catalog
- Database system principle and Application Tutorial (006)—— Compilation and installation MySQL5.7(Linux Environmental Science )
- One 、 download MySQL Installation package
- Two 、 Install required dependency packages
- 3、 ... and 、 Configure the installation environment
- Four 、 Create the required directory , Add users and groups and configure environment variables
- 5、 ... and 、 Compilation and installation MySQL 5.7
- 6、 ... and 、 To configure MySQL
- 1、 Initialization data file
- 2、 create profile
- 3、 Modify the owner and permission of the relevant directory
- 4、 To configure MySQL The startup script
- 5、 Set login account and password
- (1) After compilation and installation, you can log in without a password by default
- (2) by root Set the login password for the account
- (3) Log back in MySQL
One 、 download MySQL Installation package
1、 Get into MySQL Official website ( website :https://www.mysql.com/), single click DOWNLOADS, As shown in the figure below .
2、 At the bottom of the page 【DOWNLOADS】 Select... From the area 【MySQL Community Server】, As shown in the figure below .
3、 Click... In the pop-up page 【Archives】, As shown in the figure below .
4、 Choose... From the pop-up page MySQL Version number of (5.7.25)、 Type of operating system (Source Code) And the version of the operating system (All Operating System(Generic)(Architecture Independent)).MySQL5.7 Compiling and installing requires boost library , Choose to include boost The source package , As shown in the figure below .
Two 、 Install required dependency packages
1、 Download the required dependent packages
[[email protected] pack]# yum install -y make cmake gcc gcc-c++ bison bison-devel ncurses ncurses-devel autoconf automake --downloadonly --downloaddir=/soft/pack
[[email protected] pack]# pwd
/soft/pack
[[email protected] pack]# ll
Total usage 82764
-rw-r--r--. 1 root root 717912 7 month 4 2014 autoconf-2.69-11.el7.noarch.rpm
-rw-r--r--. 1 root root 695620 7 month 4 2014 automake-1.13.4-3.el7.noarch.rpm
-rw-r--r--. 1 root root 690564 11 month 12 2018 bison-3.0.4-2.el7.x86_64.rpm
-rw-r--r--. 1 root root 24144 11 month 12 2018 bison-devel-3.0.4-2.el7.x86_64.rpm
-rw-r--r--. 1 root root 7392732 11 month 21 2016 cmake-2.8.12.2-2.el7.x86_64.rpm
-rw-r--r--. 1 root root 6230552 10 month 15 2020 cpp-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 16963328 10 month 15 2020 gcc-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 7531804 10 month 15 2020 gcc-c++-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 3817244 5 month 19 20:50 glibc-2.17-326.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 12059896 5 month 19 20:50 glibc-common-2.17-326.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 1128524 5 month 19 20:50 glibc-devel-2.17-326.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 707512 5 month 19 20:50 glibc-headers-2.17-326.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 9496636 5 month 19 20:50 kernel-headers-3.10.0-1160.66.1.el7.x86_64.rpm
-rw-r--r--. 1 root root 326848 1 month 29 2020 libarchive-3.1.2-14.el7_7.x86_64.rpm
-rw-r--r--. 1 root root 105308 10 month 15 2020 libgcc-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 162384 10 month 15 2020 libgomp-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 51732 7 month 4 2014 libmpc-1.0.1-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 313196 10 month 15 2020 libstdc++-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 1581424 10 month 15 2020 libstdc++-devel-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 262480 11 month 25 2015 m4-1.4.16-10.el7.x86_64.rpm
-rw-r--r--. 1 root root 430712 8 month 23 2019 make-3.82-24.el7.x86_64.rpm
-rw-r--r--. 1 root root 208316 7 month 4 2014 mpfr-3.1.1-4.el7.x86_64.rpm
-rw-r--r--. 1 root root 310928 9 month 7 2017 ncurses-5.9-14.20130511.el7_4.x86_64.rpm
-rw-r--r--. 1 root root 69900 9 month 7 2017 ncurses-base-5.9-14.20130511.el7_4.noarch.rpm
-rw-r--r--. 1 root root 729508 9 month 7 2017 ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm
-rw-r--r--. 1 root root 323192 9 month 7 2017 ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm
-rw-r--r--. 1 root root 8360316 2 month 4 2021 perl-5.16.3-299.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 19672 7 month 4 2014 perl-Carp-1.26-244.el7.noarch.rpm
-rw-r--r--. 1 root root 19244 7 month 4 2014 perl-constant-1.27-2.el7.noarch.rpm
-rw-r--r--. 1 root root 48296 7 month 4 2014 perl-Data-Dumper-2.145-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 1545440 7 month 4 2014 perl-Encode-2.51-7.el7.x86_64.rpm
-rw-r--r--. 1 root root 29092 7 month 4 2014 perl-Exporter-5.68-3.el7.noarch.rpm
-rw-r--r--. 1 root root 27088 7 month 4 2014 perl-File-Path-2.09-2.el7.noarch.rpm
-rw-r--r--. 1 root root 57680 7 month 4 2014 perl-File-Temp-0.23.01-3.el7.noarch.rpm
-rw-r--r--. 1 root root 78236 7 month 4 2014 perl-Filter-1.49-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 57176 4 month 25 2018 perl-Getopt-Long-2.40-3.el7.noarch.rpm
-rw-r--r--. 1 root root 39292 7 month 4 2014 perl-HTTP-Tiny-0.033-3.el7.noarch.rpm
-rw-r--r--. 1 root root 706128 2 month 4 2021 perl-libs-5.16.3-299.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 45324 2 month 4 2021 perl-macros-5.16.3-299.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 12592 7 month 4 2014 perl-parent-0.225-244.el7.noarch.rpm
-rw-r--r--. 1 root root 84468 7 month 4 2014 perl-PathTools-3.40-5.el7.x86_64.rpm
-rw-r--r--. 1 root root 53064 2 month 4 2021 perl-Pod-Escapes-1.04-299.el7_9.noarch.rpm
-rw-r--r--. 1 root root 114320 7 month 4 2014 perl-podlators-2.5.1-3.el7.noarch.rpm
-rw-r--r--. 1 root root 88756 7 month 4 2014 perl-Pod-Perldoc-3.20-4.el7.noarch.rpm
-rw-r--r--. 1 root root 221216 7 month 4 2014 perl-Pod-Simple-3.28-4.el7.noarch.rpm
-rw-r--r--. 1 root root 27436 7 month 4 2014 perl-Pod-Usage-1.63-3.el7.noarch.rpm
-rw-r--r--. 1 root root 36808 7 month 4 2014 perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm
-rw-r--r--. 1 root root 49868 4 month 4 2020 perl-Socket-2.010-5.el7.x86_64.rpm
-rw-r--r--. 1 root root 78888 7 month 4 2014 perl-Storable-2.45-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 309212 8 month 12 2015 perl-Test-Harness-3.28-3.el7.noarch.rpm
-rw-r--r--. 1 root root 14056 7 month 4 2014 perl-Text-ParseWords-3.29-4.el7.noarch.rpm
-rw-r--r--. 1 root root 17448 7 month 4 2014 perl-Thread-Queue-3.02-2.el7.noarch.rpm
-rw-r--r--. 1 root root 50392 7 month 4 2014 perl-threads-1.87-4.el7.x86_64.rpm
-rw-r--r--. 1 root root 39868 7 month 4 2014 perl-threads-shared-1.43-6.el7.x86_64.rpm
-rw-r--r--. 1 root root 46304 7 month 4 2014 perl-Time-HiRes-1.9725-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 24792 7 month 4 2014 perl-Time-Local-1.2300-2.el7.noarch.rpm
2、 Install dependency packages
[[email protected] pack]# rpm -ivh --nodeps --force *.rpm
Warning :autoconf-2.69-11.el7.noarch.rpm: head V3 RSA/SHA256 Signature, secret key ID f4a80eb5: NOKEY
In preparation ... ################################# [100%]
Upgrading / install ...
1:libgcc-4.8.5-44.el7 ################################# [ 2%]
2:glibc-common-2.17-326.el7_9 ################################# [ 4%]
3:glibc-2.17-326.el7_9 Warning :/etc/nsswitch.conf Has been established as /etc/nsswitch.conf.rpmnew
################################# [ 5%]
4:perl-parent-1:0.225-244.el7 ################################# [ 7%]
5:perl-HTTP-Tiny-0.033-3.el7 ################################# [ 9%]
6:perl-podlators-2.5.1-3.el7 ################################# [ 11%]
7:perl-Pod-Perldoc-3.20-4.el7 ################################# [ 13%]
8:perl-Pod-Escapes-1:1.04-299.el7_9################################# [ 14%]
9:perl-Text-ParseWords-3.29-4.el7 ################################# [ 16%]
10:perl-Encode-2.51-7.el7 ################################# [ 18%]
11:perl-Pod-Usage-1.63-3.el7 ################################# [ 20%]
12:perl-constant-1.27-2.el7 ################################# [ 21%]
13:perl-Carp-1.26-244.el7 ################################# [ 23%]
14:perl-Exporter-5.68-3.el7 ################################# [ 25%]
15:perl-Filter-1.49-3.el7 ################################# [ 27%]
16:perl-libs-4:5.16.3-299.el7_9 ################################# [ 29%]
17:perl-macros-4:5.16.3-299.el7_9 ################################# [ 30%]
18:perl-File-Path-2.09-2.el7 ################################# [ 32%]
19:perl-File-Temp-0.23.01-3.el7 ################################# [ 34%]
20:perl-PathTools-3.40-5.el7 ################################# [ 36%]
21:perl-Scalar-List-Utils-1.27-248.e################################# [ 38%]
22:perl-Socket-2.010-5.el7 ################################# [ 39%]
23:perl-Storable-2.45-3.el7 ################################# [ 41%]
24:perl-threads-1.87-4.el7 ################################# [ 43%]
25:perl-threads-shared-1.43-6.el7 ################################# [ 45%]
26:perl-Pod-Simple-1:3.28-4.el7 ################################# [ 46%]
27:perl-Getopt-Long-2.40-3.el7 ################################# [ 48%]
28:perl-Time-Local-1.2300-2.el7 ################################# [ 50%]
29:perl-Time-HiRes-4:1.9725-3.el7 ################################# [ 52%]
30:perl-4:5.16.3-299.el7_9 ################################# [ 54%]
31:libstdc++-4.8.5-44.el7 ################################# [ 55%]
32:mpfr-3.1.1-4.el7 ################################# [ 57%]
33:libmpc-1.0.1-3.el7 ################################# [ 59%]
34:m4-1.4.16-10.el7 ################################# [ 61%]
35:cpp-4.8.5-44.el7 ################################# [ 63%]
36:libstdc++-devel-4.8.5-44.el7 ################################# [ 64%]
37:perl-Data-Dumper-2.145-3.el7 ################################# [ 66%]
38:autoconf-2.69-11.el7 ################################# [ 68%]
39:perl-Test-Harness-3.28-3.el7 ################################# [ 70%]
40:perl-Thread-Queue-3.02-2.el7 ################################# [ 71%]
41:libarchive-3.1.2-14.el7_7 ################################# [ 73%]
42:libgomp-4.8.5-44.el7 ################################# [ 75%]
43:ncurses-base-5.9-14.20130511.el7_################################# [ 77%]
44:ncurses-libs-5.9-14.20130511.el7_################################# [ 79%]
45:kernel-headers-3.10.0-1160.66.1.e################################# [ 80%]
46:glibc-headers-2.17-326.el7_9 ################################# [ 82%]
47:glibc-devel-2.17-326.el7_9 ################################# [ 84%]
48:gcc-4.8.5-44.el7 ################################# [ 86%]
49:gcc-c++-4.8.5-44.el7 ################################# [ 88%]
50:cmake-2.8.12.2-2.el7 ################################# [ 89%]
51:ncurses-5.9-14.20130511.el7_4 ################################# [ 91%]
52:ncurses-devel-5.9-14.20130511.el7################################# [ 93%]
53:automake-1.13.4-3.el7 ################################# [ 95%]
54:bison-3.0.4-2.el7 ################################# [ 96%]
55:make-1:3.82-24.el7 ################################# [ 98%]
56:bison-devel-3.0.4-2.el7 ################################# [100%]
3、 ... and 、 Configure the installation environment
1、 modify /etc/hosts The contents of the document are as follows
[[email protected] pack]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.1.1.7 mysql
2、 Permanent ban selinux
[[email protected] pack]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled # hold SELINUX Change the value of the option to disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[[email protected] pack]# setenforce 0
3、 Permanently shut down firewall
[[email protected] pack]# systemctl stop firewalld
[[email protected] pack]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
Four 、 Create the required directory , Add users and groups and configure environment variables
1、 Create users and groups
groupadd mysql
useradd mysql -s /sbin/nologin -M -g mysql
#====================================================================
[[email protected] pack]# groupadd mysql
[[email protected] pack]# useradd mysql -s /sbin/nologin -M -g mysql
[[email protected] pack]# id mysql
uid=1000(mysql) gid=1000(mysql) Group =1000(mysql)
2、 Create the required directories and modify permissions
# 1、MySQL Directory of execution files : Compile well mysql The program is installed in this directory
mkdir -p /usr/local/mysql/
chown mysql:mysql /usr/local/mysql/
#====================================================================
[[email protected] pack]# mkdir -p /usr/local/mysql/
[[email protected] pack]# chown mysql:mysql /usr/local/mysql/
[[email protected] pack]# ll /usr/local/
Total usage 0
drwxr-xr-x. 2 root root 6 11 month 5 2016 bin
drwxr-xr-x. 2 root root 6 11 month 5 2016 etc
drwxr-xr-x. 2 root root 6 11 month 5 2016 games
drwxr-xr-x. 2 root root 6 11 month 5 2016 include
drwxr-xr-x. 2 root root 6 11 month 5 2016 lib
drwxr-xr-x. 2 root root 6 11 month 5 2016 lib64
drwxr-xr-x. 2 root root 6 11 month 5 2016 libexec
drwxr-xr-x. 2 mysql mysql 6 7 month 1 06:23 mysql
drwxr-xr-x. 2 root root 6 11 month 5 2016 sbin
drwxr-xr-x. 5 root root 49 6 month 23 18:14 share
drwxr-xr-x. 2 root root 6 11 month 5 2016 src
mkdir -p /home/mysql/data
mkdir -p /home/mysql/logs
mkdir -p /home/mysql/temp
chown mysql:mysql /home/mysql/*
#============================================================
# 2、MySQL Data file directory
[[email protected] pack]# mkdir -p /home/mysql/data
# 3、MySQL Log directory
[[email protected] pack]# mkdir -p /home/mysql/logs
[[email protected] pack]# mkdir -p /home/mysql/temp
# 4、 Modify the owner of the directory
[[email protected] pack]# chown mysql:mysql /home/mysql/*
[[email protected] pack]# ll /home/mysql
Total usage 0
drwxr-xr-x. 2 mysql mysql 6 7 month 1 06:24 data
drwxr-xr-x. 2 mysql mysql 6 7 month 1 06:24 logs
drwxr-xr-x. 2 mysql mysql 6 7 month 1 06:24 temp
3、 Configure environment variables
stay /etc/profile Add the following at the end of the file :
[[email protected] pack]# vi /etc/profile
unset -f pathmunge
..........
export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
[[email protected] pack]# source /etc/profile
5、 ... and 、 Compilation and installation MySQL 5.7
1、 Upload installation files
[[email protected] soft]# pwd
/soft
[[email protected] soft]# ll
Total usage 47966
drwxr-xr-x. 8 root root 2048 12 month 5 2016 cdrom
-rw-r--r--. 1 root root 49107578 6 month 30 14:41 mysql-boost-5.7.25.tar.gz
drwxr-xr-x. 2 root root 4096 7 month 1 06:18 pack
2、 Unzip the installation file
[[email protected] soft]# tar -zxvf mysql-boost-5.7.25.tar.gz
[[email protected] soft]# ll
Total usage 47970
drwxr-xr-x. 8 root root 2048 12 month 5 2016 cdrom
drwxr-xr-x. 36 7161 31415 4096 12 month 21 2018 mysql-5.7.25
-rw-r--r--. 1 root root 49107578 6 month 30 14:41 mysql-boost-5.7.25.tar.gz
drwxr-xr-x. 2 root root 4096 7 month 1 06:18 pack
[[email protected] soft]# cd mysql-5.7.25/
[[email protected] mysql-5.7.25]# ll
Total usage 280
drwxr-xr-x. 3 7161 31415 26 12 month 21 2018 boost
drwxr-xr-x. 2 7161 31415 4096 12 month 21 2018 BUILD
drwxr-xr-x. 6 7161 31415 4096 12 month 21 2018 client
drwxr-xr-x. 4 7161 31415 4096 12 month 21 2018 cmake
-rw-r--r--. 1 7161 31415 27753 12 month 21 2018 CMakeLists.txt
drwxr-xr-x. 3 7161 31415 21 12 month 21 2018 cmd-line-utils
-rw-r--r--. 1 7161 31415 13900 12 month 21 2018 config.h.cmake
-rw-r--r--. 1 7161 31415 25850 12 month 21 2018 configure.cmake
-rw-r--r--. 1 7161 31415 17987 12 month 21 2018 COPYING
drwxr-xr-x. 2 7161 31415 4096 12 month 21 2018 dbug
drwxr-xr-x. 2 7161 31415 80 12 month 21 2018 Docs
-rw-r--r--. 1 7161 31415 66241 12 month 21 2018 Doxyfile-perfschema
drwxr-xr-x. 6 7161 31415 4096 12 month 21 2018 extra
drwxr-xr-x. 5 7161 31415 4096 12 month 21 2018 include
-rw-r--r--. 1 7161 31415 333 12 month 21 2018 INSTALL
drwxr-xr-x. 5 7161 31415 135 12 month 21 2018 libbinlogevents
drwxr-xr-x. 3 7161 31415 39 12 month 21 2018 libbinlogstandalone
drwxr-xr-x. 7 7161 31415 4096 12 month 21 2018 libevent
drwxr-xr-x. 4 7161 31415 275 12 month 21 2018 libmysql
drwxr-xr-x. 3 7161 31415 204 12 month 21 2018 libmysqld
drwxr-xr-x. 2 7161 31415 4096 12 month 21 2018 libservices
drwxr-xr-x. 2 7161 31415 4096 12 month 21 2018 man
drwxr-xr-x. 10 7161 31415 4096 12 month 21 2018 mysql-test
drwxr-xr-x. 2 7161 31415 4096 12 month 21 2018 mysys
drwxr-xr-x. 2 7161 31415 4096 12 month 21 2018 mysys_ssl
drwxr-xr-x. 10 7161 31415 131 12 month 21 2018 packaging
drwxr-xr-x. 18 7161 31415 4096 12 month 21 2018 plugin
drwxr-xr-x. 4 7161 31415 36 12 month 21 2018 rapid
-rw-r--r--. 1 7161 31415 2478 12 month 21 2018 README
drwxr-xr-x. 2 7161 31415 4096 12 month 21 2018 regex
drwxr-xr-x. 3 7161 31415 4096 12 month 21 2018 scripts
drwxr-xr-x. 7 7161 31415 20480 12 month 21 2018 sql
drwxr-xr-x. 2 7161 31415 198 12 month 21 2018 sql-common
drwxr-xr-x. 13 7161 31415 175 12 month 21 2018 storage
drwxr-xr-x. 2 7161 31415 4096 12 month 21 2018 strings
drwxr-xr-x. 4 7161 31415 241 12 month 21 2018 support-files
drwxr-xr-x. 2 7161 31415 98 12 month 21 2018 testclients
drwxr-xr-x. 5 7161 31415 70 12 month 21 2018 unittest
-rw-r--r--. 1 7161 31415 88 12 month 21 2018 VERSION
drwxr-xr-x. 3 7161 31415 4096 12 month 21 2018 vio
drwxr-xr-x. 2 7161 31415 32 12 month 21 2018 win
drwxr-xr-x. 11 7161 31415 4096 12 month 21 2018 zlib
3、 Compilation and installation MySQL
(1) perform cmake command
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/home/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DSYSCONFDIR=/etc \
-DWITH_BOOST=./boost
# Parameter description :
# (1)DCMAKE_INSTALL_PREFIX: Appoint MySQL The installation path ;
# (2)DMYSQL_DATADIR: Appoint MySQL Database storage directory ;
# (3)DMYSQL_UNIX_ADDR: Appoint sock Path to file ;
# (4)DSYSCONFDIR: Specify the profile path ;
# (5)DWITH_MYISAM_STORAGE_ENGINE=1: install myisam Storage engine ;
# (6)DWITH_INNOBASE_STORAGE_ENGINE=1: install innodb Storage engine ;
# (7)DDEFAULT_CHARSET: Set default character set ;
# (8)DDEFAULT_COLLATION: Set default proofing set ;
# (9)DMYSQL_TCP_PORT: Set server listening port , Default 3306.
# =========================================================================================
[[email protected] mysql-5.7.25]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
> -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci \
> -DWITH_MYISAM_STORAGE_ENGINE=1 \
> -DWITH_INNOBASE_STORAGE_ENGINE=1 \
> -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
> -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
> -DWITH_MEMORY_STORAGE_ENGINE=1 \
> -DWITH_READLINE=1 \
> -DENABLED_LOCAL_INFILE=1 \
> -DMYSQL_DATADIR=/home/mysql/data \
> -DMYSQL_USER=mysql \
> -DMYSQL_TCP_PORT=3306 \
> -DSYSCONFDIR=/etc \
> -DWITH_BOOST=./boost
-- Running cmake version 2.8.12.2
-- Could NOT find Git (missing: GIT_EXECUTABLE)
-- Configuring with MAX_INDEXES = 64U
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
..............
(2) perform make & make install command
[[email protected] mysql-5.7.25]# make & make install
...............
[[email protected] mysql-5.7.25]# make clean
6、 ... and 、 To configure MySQL
1、 Initialization data file
[[email protected] bin]# ./mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2022-06-30T23:19:31.968785Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation f
or more details).2022-06-30T23:19:33.302137Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-06-30T23:19:33.478698Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-06-30T23:19:33.541446Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID:
19bb8d85-f8cb-11ec-bdeb-000c2913d893.2022-06-30T23:19:33.544704Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-06-30T23:19:33.546445Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option.
2、 create profile
[[email protected] bin]# vi /etc/my.cnf
[client]
#password = your_password
port = 3306
socket = /usr/local/mysql/tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
pid-file = /usr/local/mysql/mysql.pid
log_error = /usr/local/mysql/mysql-error.log
socket = /usr/local/mysql/tmp/mysql.sock
3、 Modify the owner and permission of the relevant directory
# Catalog :/tmp
[[email protected] mysql]# chmod -R 1777 /tmp
[[email protected] mysql]# /usr/local/mysql/tmp/
# Create error log file
[[email protected] mysql]# touch /usr/local/mysql/mysql-error.log
# Modify the catalog /usr/local/mysql Owned by mysql:mysql
[[email protected] mysql]# chown -R mysql:mysql /usr/local/mysql
[[email protected] mysql]# ll /usr/local/mysql
Total usage 64
drwxr-xr-x. 2 mysql mysql 4096 7 month 1 07:10 bin
-rw-r--r--. 1 mysql mysql 17987 12 month 21 2018 COPYING
-rw-r--r--. 1 mysql mysql 17987 12 month 21 2018 COPYING-test
drwxr-x---. 5 mysql mysql 147 7 month 1 07:47 data
drwxr-xr-x. 2 mysql mysql 55 7 month 1 07:10 docs
drwxr-xr-x. 3 mysql mysql 4096 7 month 1 07:10 include
drwxr-xr-x. 4 mysql mysql 192 7 month 1 07:10 lib
drwxr-xr-x. 4 mysql mysql 30 7 month 1 07:10 man
-rw-r--r--. 1 mysql mysql 0 7 month 1 07:38 mysql-error.log
drwxr-xr-x. 10 mysql mysql 4096 7 month 1 07:11 mysql-test
-rw-r--r--. 1 mysql mysql 2478 12 month 21 2018 README
-rw-r--r--. 1 mysql mysql 2478 12 month 21 2018 README-test
drwxr-xr-x. 28 mysql mysql 4096 7 month 1 07:11 share
drwxr-xr-x. 2 mysql mysql 90 7 month 1 07:11 support-files
drwxr-xr-x. 2 mysql mysql 6 7 month 1 07:35 tmp
4、 To configure MySQL The startup script
[[email protected] support-files]# pwd
/usr/local/mysql/support-files
[[email protected] support-files]# cp ./mysql.server /etc/init.d/mysqld
[[email protected] mysql]# chmod 700 /etc/init.d/mysqld
# start-up mysql service
[[email protected] mysql]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
# Set up Mysql Boot up
[[email protected] mysql]# chkconfig mysqld on
[[email protected] mysql]# chkconfig --list mysqld
Be careful : The output only shows SysV service , It doesn't contain the original systemd service .SysV Configuration data may be native systemd Configure override .
If you want to list systemd service , Please perform 'systemctl list-unit-files'.
To view the specific target Please execute... For enabled services
'systemctl list-dependencies [target]'.
mysqld 0: Turn off 1: Turn off 2: open 3: open 4: open 5: open 6: Turn off
5、 Set login account and password
(1) After compilation and installation, you can log in without a password by default
[[email protected] mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.25 Source distribution
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
(2) by root Set the login password for the account
mysql> alter user root@localhost identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
(3) Log back in MySQL
[[email protected] mysql]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[[email protected] mysql]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.25 Source distribution
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
边栏推荐
- China's intelligent transportation construction from the perspective of "one hour life circle" in Dawan District
- Use Tencent cloud to build a map bed service
- 【SQL语句】请问这边为什么select出了两个上海,查询出了不同的count我想让他变成一个上海,count只显示一个总和
- 部门来了个拿25k出来的00后测试卷王,老油条表示真干不过,已被...
- 红队第10篇:coldfusion反序列化过waf改exp拿靶标的艰难过程
- 电脑照片尺寸如何调整成自己想要的
- ssm框架原理
- idea启动Command line is too long问题处理
- 投稿开奖丨轻量应用服务器征文活动(5月)奖励公布
- Analysis of PostgreSQL storage structure
猜你喜欢
Problems encountered in IM instant messaging development to maintain heartbeat
【LeetCode】43. String multiplication
电脑照片尺寸如何调整成自己想要的
Vscode find and replace the data of all files in a folder
Overview | slam of laser and vision fusion
2022 Moonriver global hacker song winning project list
制造业数字化转型究竟是什么
Research on multi model architecture of ads computing power chip
芯片供应转向过剩,中国芯片日产增加至10亿,国外芯片将更难受
Sweden announced its decision to exclude Huawei 5g equipment, but Huawei has successfully found a new way out
随机推荐
红队第10篇:coldfusion反序列化过waf改exp拿靶标的艰难过程
Learn selenium to simulate mouse operation, and you can be lazy a little bit
近半年内连获5家“巨头”投资,这家智能驾驶“黑马”受资本追捧
Sqlserver query: when a.id is the same as b.id, and the A.P corresponding to a.id cannot be found in the B.P corresponding to b.id, the a.id and A.P will be displayed
[每日一氵]Latex 的通讯作者怎么搞
How to adjust the color of the computer screen and how to change the color of the computer screen
Comment utiliser le langage MySQL pour les appareils de ligne et de ligne?
Go 语言怎么使用对称加密?
[nodemon] app crashed - waiting for file changes before starting...解决方法
ssm框架原理
Where should older test / development programmers go? Will it be abandoned by the times?
Automatique, intelligent, visuel! Forte conviction des huit conceptions derrière la solution sslo
运动捕捉系统原理
Motion capture system for apple picking robot
Can't global transactions be used when shardingjdbc is used in seate?
2023 spring recruitment Internship - personal interview process and face-to-face experience sharing
Origin2018安装与使用(整理中)
Pocket network supports moonbeam and Moonriver RPC layers
C#/VB. Net merge PDF document
学会了selenium 模拟鼠标操作,你就可以偷懒点点点了