当前位置:网站首页>Principes et applications du système de base de données (006) - - compilation et installation de MySQL 5.7 (environnement Linux)
Principes et applications du système de base de données (006) - - compilation et installation de MySQL 5.7 (environnement Linux)
2022-07-01 16:19:00 【Ristar DBA Wgx】
Tutoriel sur les principes et les applications du système de base de données(006)—— Compiler l'installation MySQL5.7(Linux Environnement)
Table des matières
- Tutoriel sur les principes et les applications du système de base de données(006)—— Compiler l'installation MySQL5.7(Linux Environnement)
- Un.、Télécharger MySQL Paquet d'installation
- 2.、Installer les paquets de dépendances nécessaires
- Trois、Configurer l'environnement d'installation
- Quatre、Créer le répertoire désiré,Ajouter des utilisateurs et des groupes et configurer les variables d'environnement
- Cinq、Compiler l'installation MySQL 5.7
- Six、Configuration MySQL
- 1、Initialiser le fichier de données
- 2、Créer un profil
- 3、 Modifier le propriétaire et les permissions du Répertoire associé
- 4、ConfigurationMySQLDémarrer le script
- 5、 Définir le compte de connexion et le mot de passe
- (1) Une fois l'installation compilée terminée, vous pouvez vous connecter sans mot de passe par défaut
- (2)Pour root Configuration du compte mot de passe de connexion
- (3)Reconnecter MySQL
Un.、Télécharger MySQL Paquet d'installation
1、Entrée MySQLSite officiel(Site Web:https://www.mysql.com/),Cliquez sur DOWNLOADS,Comme le montre la figure ci - dessous.
2、Au bas de la page【DOWNLOADS】 Sélectionner dans la zone 【MySQL Community Server】,Comme le montre la figure ci - dessous.
3、Cliquez sur la page qui apparaît【Archives】,Comme le montre la figure ci - dessous.
4、Sélectionnez dans la page contextuelle MySQL Numéro de version(5.7.25)、 Type de système d'exploitation (Source Code) Et la version du système d'exploitation (All Operating System(Generic)(Architecture Independent)).MySQL5.7 Compiler les exigences d'installation boost Bibliothèque,Sélectionner inclure boost Code source package for,Comme le montre la figure ci - dessous.
2.、Installer les paquets de dépendances nécessaires
1、Télécharger les paquets de dépendance requis
[[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
Consommation totale 82764
-rw-r--r--. 1 root root 717912 7Mois 4 2014 autoconf-2.69-11.el7.noarch.rpm
-rw-r--r--. 1 root root 695620 7Mois 4 2014 automake-1.13.4-3.el7.noarch.rpm
-rw-r--r--. 1 root root 690564 11Mois 12 2018 bison-3.0.4-2.el7.x86_64.rpm
-rw-r--r--. 1 root root 24144 11Mois 12 2018 bison-devel-3.0.4-2.el7.x86_64.rpm
-rw-r--r--. 1 root root 7392732 11Mois 21 2016 cmake-2.8.12.2-2.el7.x86_64.rpm
-rw-r--r--. 1 root root 6230552 10Mois 15 2020 cpp-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 16963328 10Mois 15 2020 gcc-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 7531804 10Mois 15 2020 gcc-c++-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 3817244 5Mois 19 20:50 glibc-2.17-326.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 12059896 5Mois 19 20:50 glibc-common-2.17-326.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 1128524 5Mois 19 20:50 glibc-devel-2.17-326.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 707512 5Mois 19 20:50 glibc-headers-2.17-326.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 9496636 5Mois 19 20:50 kernel-headers-3.10.0-1160.66.1.el7.x86_64.rpm
-rw-r--r--. 1 root root 326848 1Mois 29 2020 libarchive-3.1.2-14.el7_7.x86_64.rpm
-rw-r--r--. 1 root root 105308 10Mois 15 2020 libgcc-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 162384 10Mois 15 2020 libgomp-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 51732 7Mois 4 2014 libmpc-1.0.1-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 313196 10Mois 15 2020 libstdc++-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 1581424 10Mois 15 2020 libstdc++-devel-4.8.5-44.el7.x86_64.rpm
-rw-r--r--. 1 root root 262480 11Mois 25 2015 m4-1.4.16-10.el7.x86_64.rpm
-rw-r--r--. 1 root root 430712 8Mois 23 2019 make-3.82-24.el7.x86_64.rpm
-rw-r--r--. 1 root root 208316 7Mois 4 2014 mpfr-3.1.1-4.el7.x86_64.rpm
-rw-r--r--. 1 root root 310928 9Mois 7 2017 ncurses-5.9-14.20130511.el7_4.x86_64.rpm
-rw-r--r--. 1 root root 69900 9Mois 7 2017 ncurses-base-5.9-14.20130511.el7_4.noarch.rpm
-rw-r--r--. 1 root root 729508 9Mois 7 2017 ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm
-rw-r--r--. 1 root root 323192 9Mois 7 2017 ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm
-rw-r--r--. 1 root root 8360316 2Mois 4 2021 perl-5.16.3-299.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 19672 7Mois 4 2014 perl-Carp-1.26-244.el7.noarch.rpm
-rw-r--r--. 1 root root 19244 7Mois 4 2014 perl-constant-1.27-2.el7.noarch.rpm
-rw-r--r--. 1 root root 48296 7Mois 4 2014 perl-Data-Dumper-2.145-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 1545440 7Mois 4 2014 perl-Encode-2.51-7.el7.x86_64.rpm
-rw-r--r--. 1 root root 29092 7Mois 4 2014 perl-Exporter-5.68-3.el7.noarch.rpm
-rw-r--r--. 1 root root 27088 7Mois 4 2014 perl-File-Path-2.09-2.el7.noarch.rpm
-rw-r--r--. 1 root root 57680 7Mois 4 2014 perl-File-Temp-0.23.01-3.el7.noarch.rpm
-rw-r--r--. 1 root root 78236 7Mois 4 2014 perl-Filter-1.49-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 57176 4Mois 25 2018 perl-Getopt-Long-2.40-3.el7.noarch.rpm
-rw-r--r--. 1 root root 39292 7Mois 4 2014 perl-HTTP-Tiny-0.033-3.el7.noarch.rpm
-rw-r--r--. 1 root root 706128 2Mois 4 2021 perl-libs-5.16.3-299.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 45324 2Mois 4 2021 perl-macros-5.16.3-299.el7_9.x86_64.rpm
-rw-r--r--. 1 root root 12592 7Mois 4 2014 perl-parent-0.225-244.el7.noarch.rpm
-rw-r--r--. 1 root root 84468 7Mois 4 2014 perl-PathTools-3.40-5.el7.x86_64.rpm
-rw-r--r--. 1 root root 53064 2Mois 4 2021 perl-Pod-Escapes-1.04-299.el7_9.noarch.rpm
-rw-r--r--. 1 root root 114320 7Mois 4 2014 perl-podlators-2.5.1-3.el7.noarch.rpm
-rw-r--r--. 1 root root 88756 7Mois 4 2014 perl-Pod-Perldoc-3.20-4.el7.noarch.rpm
-rw-r--r--. 1 root root 221216 7Mois 4 2014 perl-Pod-Simple-3.28-4.el7.noarch.rpm
-rw-r--r--. 1 root root 27436 7Mois 4 2014 perl-Pod-Usage-1.63-3.el7.noarch.rpm
-rw-r--r--. 1 root root 36808 7Mois 4 2014 perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm
-rw-r--r--. 1 root root 49868 4Mois 4 2020 perl-Socket-2.010-5.el7.x86_64.rpm
-rw-r--r--. 1 root root 78888 7Mois 4 2014 perl-Storable-2.45-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 309212 8Mois 12 2015 perl-Test-Harness-3.28-3.el7.noarch.rpm
-rw-r--r--. 1 root root 14056 7Mois 4 2014 perl-Text-ParseWords-3.29-4.el7.noarch.rpm
-rw-r--r--. 1 root root 17448 7Mois 4 2014 perl-Thread-Queue-3.02-2.el7.noarch.rpm
-rw-r--r--. 1 root root 50392 7Mois 4 2014 perl-threads-1.87-4.el7.x86_64.rpm
-rw-r--r--. 1 root root 39868 7Mois 4 2014 perl-threads-shared-1.43-6.el7.x86_64.rpm
-rw-r--r--. 1 root root 46304 7Mois 4 2014 perl-Time-HiRes-1.9725-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 24792 7Mois 4 2014 perl-Time-Local-1.2300-2.el7.noarch.rpm
2、Installer des paquets dépendants
[[email protected] pack]# rpm -ivh --nodeps --force *.rpm
Attention:autoconf-2.69-11.el7.noarch.rpm: TêteV3 RSA/SHA256 Signature, La clé ID f4a80eb5: NOKEY
En préparation... ################################# [100%]
Mise à jour/Installation...
1:libgcc-4.8.5-44.el7 ################################# [ 2%]
2:glibc-common-2.17-326.el7_9 ################################# [ 4%]
3:glibc-2.17-326.el7_9 Attention:/etc/nsswitch.conf Créé en tant que /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%]
Trois、Configurer l'environnement d'installation
1、Modifier /etc/hosts Le contenu du document est le suivant:
[[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、Fermeture permanente 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 # Prends ça. SELINUX La valeur de l'option est modifiée à 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、Fermeture permanente du pare - feu
[[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.
Quatre、Créer le répertoire désiré,Ajouter des utilisateurs et des groupes et configurer les variables d'environnement
1、Créer des utilisateurs et des groupes
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) Groupe=1000(mysql)
2、Créer le répertoire désiré et modifier les permissions
# 1、MySQL Répertoire des fichiers d'exécution:Compilé mysql Programmes installés dans ce répertoire
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/
Consommation totale 0
drwxr-xr-x. 2 root root 6 11Mois 5 2016 bin
drwxr-xr-x. 2 root root 6 11Mois 5 2016 etc
drwxr-xr-x. 2 root root 6 11Mois 5 2016 games
drwxr-xr-x. 2 root root 6 11Mois 5 2016 include
drwxr-xr-x. 2 root root 6 11Mois 5 2016 lib
drwxr-xr-x. 2 root root 6 11Mois 5 2016 lib64
drwxr-xr-x. 2 root root 6 11Mois 5 2016 libexec
drwxr-xr-x. 2 mysql mysql 6 7Mois 1 06:23 mysql
drwxr-xr-x. 2 root root 6 11Mois 5 2016 sbin
drwxr-xr-x. 5 root root 49 6Mois 23 18:14 share
drwxr-xr-x. 2 root root 6 11Mois 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 Répertoire des fichiers de données
[[email protected] pack]# mkdir -p /home/mysql/data
# 3、MySQL Répertoire des journaux
[[email protected] pack]# mkdir -p /home/mysql/logs
[[email protected] pack]# mkdir -p /home/mysql/temp
# 4、 Modifier le propriétaire du Répertoire
[[email protected] pack]# chown mysql:mysql /home/mysql/*
[[email protected] pack]# ll /home/mysql
Consommation totale 0
drwxr-xr-x. 2 mysql mysql 6 7Mois 1 06:24 data
drwxr-xr-x. 2 mysql mysql 6 7Mois 1 06:24 logs
drwxr-xr-x. 2 mysql mysql 6 7Mois 1 06:24 temp
3、Configurer les variables d'environnement
In /etc/profile Ajouter ce qui suit à la fin du document:
[[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
Cinq、Compiler l'installation MySQL 5.7
1、Télécharger le fichier d'installation
[[email protected] soft]# pwd
/soft
[[email protected] soft]# ll
Consommation totale 47966
drwxr-xr-x. 8 root root 2048 12Mois 5 2016 cdrom
-rw-r--r--. 1 root root 49107578 6Mois 30 14:41 mysql-boost-5.7.25.tar.gz
drwxr-xr-x. 2 root root 4096 7Mois 1 06:18 pack
2、Décompresser le fichier d'installation
[[email protected] soft]# tar -zxvf mysql-boost-5.7.25.tar.gz
[[email protected] soft]# ll
Consommation totale 47970
drwxr-xr-x. 8 root root 2048 12Mois 5 2016 cdrom
drwxr-xr-x. 36 7161 31415 4096 12Mois 21 2018 mysql-5.7.25
-rw-r--r--. 1 root root 49107578 6Mois 30 14:41 mysql-boost-5.7.25.tar.gz
drwxr-xr-x. 2 root root 4096 7Mois 1 06:18 pack
[[email protected] soft]# cd mysql-5.7.25/
[[email protected] mysql-5.7.25]# ll
Consommation totale 280
drwxr-xr-x. 3 7161 31415 26 12Mois 21 2018 boost
drwxr-xr-x. 2 7161 31415 4096 12Mois 21 2018 BUILD
drwxr-xr-x. 6 7161 31415 4096 12Mois 21 2018 client
drwxr-xr-x. 4 7161 31415 4096 12Mois 21 2018 cmake
-rw-r--r--. 1 7161 31415 27753 12Mois 21 2018 CMakeLists.txt
drwxr-xr-x. 3 7161 31415 21 12Mois 21 2018 cmd-line-utils
-rw-r--r--. 1 7161 31415 13900 12Mois 21 2018 config.h.cmake
-rw-r--r--. 1 7161 31415 25850 12Mois 21 2018 configure.cmake
-rw-r--r--. 1 7161 31415 17987 12Mois 21 2018 COPYING
drwxr-xr-x. 2 7161 31415 4096 12Mois 21 2018 dbug
drwxr-xr-x. 2 7161 31415 80 12Mois 21 2018 Docs
-rw-r--r--. 1 7161 31415 66241 12Mois 21 2018 Doxyfile-perfschema
drwxr-xr-x. 6 7161 31415 4096 12Mois 21 2018 extra
drwxr-xr-x. 5 7161 31415 4096 12Mois 21 2018 include
-rw-r--r--. 1 7161 31415 333 12Mois 21 2018 INSTALL
drwxr-xr-x. 5 7161 31415 135 12Mois 21 2018 libbinlogevents
drwxr-xr-x. 3 7161 31415 39 12Mois 21 2018 libbinlogstandalone
drwxr-xr-x. 7 7161 31415 4096 12Mois 21 2018 libevent
drwxr-xr-x. 4 7161 31415 275 12Mois 21 2018 libmysql
drwxr-xr-x. 3 7161 31415 204 12Mois 21 2018 libmysqld
drwxr-xr-x. 2 7161 31415 4096 12Mois 21 2018 libservices
drwxr-xr-x. 2 7161 31415 4096 12Mois 21 2018 man
drwxr-xr-x. 10 7161 31415 4096 12Mois 21 2018 mysql-test
drwxr-xr-x. 2 7161 31415 4096 12Mois 21 2018 mysys
drwxr-xr-x. 2 7161 31415 4096 12Mois 21 2018 mysys_ssl
drwxr-xr-x. 10 7161 31415 131 12Mois 21 2018 packaging
drwxr-xr-x. 18 7161 31415 4096 12Mois 21 2018 plugin
drwxr-xr-x. 4 7161 31415 36 12Mois 21 2018 rapid
-rw-r--r--. 1 7161 31415 2478 12Mois 21 2018 README
drwxr-xr-x. 2 7161 31415 4096 12Mois 21 2018 regex
drwxr-xr-x. 3 7161 31415 4096 12Mois 21 2018 scripts
drwxr-xr-x. 7 7161 31415 20480 12Mois 21 2018 sql
drwxr-xr-x. 2 7161 31415 198 12Mois 21 2018 sql-common
drwxr-xr-x. 13 7161 31415 175 12Mois 21 2018 storage
drwxr-xr-x. 2 7161 31415 4096 12Mois 21 2018 strings
drwxr-xr-x. 4 7161 31415 241 12Mois 21 2018 support-files
drwxr-xr-x. 2 7161 31415 98 12Mois 21 2018 testclients
drwxr-xr-x. 5 7161 31415 70 12Mois 21 2018 unittest
-rw-r--r--. 1 7161 31415 88 12Mois 21 2018 VERSION
drwxr-xr-x. 3 7161 31415 4096 12Mois 21 2018 vio
drwxr-xr-x. 2 7161 31415 32 12Mois 21 2018 win
drwxr-xr-x. 11 7161 31415 4096 12Mois 21 2018 zlib
3、Compiler l'installation MySQL
(1)Mise en œuvre cmake Les ordres
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
# Description des paramètres:
# (1)DCMAKE_INSTALL_PREFIX:DésignationMySQLChemin d'installation;
# (2)DMYSQL_DATADIR:DésignationMySQLRépertoire de stockage de la base de données;
# (3)DMYSQL_UNIX_ADDR:DésignationsockChemin du fichier;
# (4)DSYSCONFDIR:Spécifier le chemin du profil;
# (5)DWITH_MYISAM_STORAGE_ENGINE=1:Installation myisam Moteur de stockage;
# (6)DWITH_INNOBASE_STORAGE_ENGINE=1:Installation innodb Moteur de stockage;
# (7)DDEFAULT_CHARSET:Définir le jeu de caractères par défaut;
# (8)DDEFAULT_COLLATION: Définir l'ensemble de correction par défaut ;
# (9)DMYSQL_TCP_PORT:Définir le port d'écoute du serveur,Par défaut 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)Mise en œuvre make & make install Les ordres
[[email protected] mysql-5.7.25]# make & make install
...............
[[email protected] mysql-5.7.25]# make clean
Six、Configuration MySQL
1、Initialiser le fichier de données
[[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、Créer un profil
[[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、 Modifier le propriétaire et les permissions du Répertoire associé
# Table des matières:/tmp
[[email protected] mysql]# chmod -R 1777 /tmp
[[email protected] mysql]# /usr/local/mysql/tmp/
# Créer un fichier de journal des erreurs
[[email protected] mysql]# touch /usr/local/mysql/mysql-error.log
# Modifier la table des matières /usr/local/mysql Propriétaire de mysql:mysql
[[email protected] mysql]# chown -R mysql:mysql /usr/local/mysql
[[email protected] mysql]# ll /usr/local/mysql
Consommation totale 64
drwxr-xr-x. 2 mysql mysql 4096 7Mois 1 07:10 bin
-rw-r--r--. 1 mysql mysql 17987 12Mois 21 2018 COPYING
-rw-r--r--. 1 mysql mysql 17987 12Mois 21 2018 COPYING-test
drwxr-x---. 5 mysql mysql 147 7Mois 1 07:47 data
drwxr-xr-x. 2 mysql mysql 55 7Mois 1 07:10 docs
drwxr-xr-x. 3 mysql mysql 4096 7Mois 1 07:10 include
drwxr-xr-x. 4 mysql mysql 192 7Mois 1 07:10 lib
drwxr-xr-x. 4 mysql mysql 30 7Mois 1 07:10 man
-rw-r--r--. 1 mysql mysql 0 7Mois 1 07:38 mysql-error.log
drwxr-xr-x. 10 mysql mysql 4096 7Mois 1 07:11 mysql-test
-rw-r--r--. 1 mysql mysql 2478 12Mois 21 2018 README
-rw-r--r--. 1 mysql mysql 2478 12Mois 21 2018 README-test
drwxr-xr-x. 28 mysql mysql 4096 7Mois 1 07:11 share
drwxr-xr-x. 2 mysql mysql 90 7Mois 1 07:11 support-files
drwxr-xr-x. 2 mysql mysql 6 7Mois 1 07:35 tmp
4、ConfigurationMySQLDémarrer le 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
# Démarrage mysql Services
[[email protected] mysql]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
# Paramètres Mysql Démarrage automatique
[[email protected] mysql]# chkconfig mysqld on
[[email protected] mysql]# chkconfig --list mysqld
Attention!:Cette sortie ne montre que SysV Services, Ne contient pas de systemd Services.SysV Les données de configuration peuvent être natives systemd Configurer la superposition.
Si vous voulez Lister systemd Services,S'il vous plaît. 'systemctl list-unit-files'.
Pour voir un exemple de target Service activé Veuillez exécuter
'systemctl list-dependencies [target]'.
mysqld 0:Coupez. 1:Coupez. 2:Vas - y. 3:Vas - y. 4:Vas - y. 5:Vas - y. 6:Coupez.
5、 Définir le compte de connexion et le mot de passe
(1) Une fois l'installation compilée terminée, vous pouvez vous connecter sans mot de passe par défaut
[[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)Pour root Configuration du compte mot de passe de connexion
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)Reconnecter 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>
边栏推荐
- 部门来了个拿25k出来的00后测试卷王,老油条表示真干不过,已被...
- [PHP graduation design] design and implementation of textbook management system based on php+mysql+apache (graduation thesis + program source code) -- textbook management system
- idea启动Command line is too long问题处理
- process. env. NODE_ ENV
- 【每日一题】1175. 质数排列
- Idea start command line is too long problem handling
- 2023 spring recruitment Internship - personal interview process and face-to-face experience sharing
- Problèmes rencontrés dans le développement de la GI pour maintenir le rythme cardiaque en vie
- 2023届春招实习-个人面试过程和面经分享
- vscode 查找 替换 一个文件夹下所有文件的数据
猜你喜欢
运动捕捉系统原理
Embedded development: five revision control best practices
She is the "HR of others" | ones character
Win11如何设置用户权限?Win11设置用户权限的方法
【观察】数字化时代的咨询往何处走?软通咨询的思与行
【Hot100】17. 电话号码的字母组合
Nuxt.js数据预取
Automatique, intelligent, visuel! Forte conviction des huit conceptions derrière la solution sslo
【LeetCode】43. String multiplication
SQLServer查询: a.id与b.id相同时,a.id对应的a.p在b.id对应的b.p里找不到的话,就显示出这个a.id和a.p
随机推荐
表格存储中tablestore 目前支持mysql哪些函数呢?
Zabbix2.2监控之系统及应用日志监控报警
毕业后5年,我成为了年薪30w+的测试开发工程师
Introduction to RT thread env tool (learning notes)
Smart Party Building: faith through time and space | 7.1 dedication
Stonedb is building blocks for domestic databases, and the integrated real-time HTAP database based on MySQL is officially open source!
STM32F1与STM32CubeIDE编程实例-PWM驱动蜂鸣器生产旋律
Can't global transactions be used when shardingjdbc is used in seate?
Zero copy technology of MySQL
July 1, 2022 Daily: Google's new research: Minerva, using language models to solve quantitative reasoning problems
从大湾区“1小时生活圈”看我国智慧交通建设
Go 语言错误处理为什么更推荐使用 pkg/errors 三方库?
How to adjust the size of computer photos to what you want
怎麼用MySQL語言進行行列裝置?
Win11如何設置用戶權限?Win11設置用戶權限的方法
Microservice tracking SQL (support Gorm query tracking under isto control)
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
Seate中用了shardingjdbc 就不能用全局事务了吗?
Five years after graduation, I became a test development engineer with an annual salary of 30w+
复杂度相关OJ题(LeetCode、C语言、复杂度、消失的数字、旋转数组)