MySQL 5.7.21如何在Linux平台中安装Part 2
在本篇文章中,我们将详细介绍如何在Linux平台中安装MySQL 5.7.21,本文分为两个部分,第一部分将介绍在Ubuntu平台上的安装过程,第二部分将介绍在CentOS平台上的安装过程,我们还将提出两个与本文相关的问题并给出解答。
在Ubuntu平台上的安装过程
1、更新系统软件包列表
我们需要更新系统的软件包列表,以确保我们能够获取到最新版本的MySQL,在终端中输入以下命令:
sudo apt-get update
2、安装依赖库
接下来,我们需要安装一些依赖库,这些库将帮助我们编译和运行MySQL,在终端中输入以下命令:
sudo apt-get install build-essential libssl-dev
3、下载MySQL源码包
现在,我们可以开始下载MySQL的源码包了,在终端中输入以下命令:
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21.tar.gz
4、解压源码包
下载完成后,我们需要解压源码包,在终端中输入以下命令:
tar -xvf mysql-5.7.21.tar.gz
5、进入解压后的目录
解压完成后,我们需要进入解压后的目录,在终端中输入以下命令:
cd mysql-5.7.21
6、编译并安装MySQL
现在,我们可以开始编译并安装MySQL了,在终端中输入以下命令:
sudo apt-get install libaio1 libmecab2 make all testinstall && sudo make install
7、配置MySQL
编译完成后,我们需要对MySQL进行配置,创建一个名为mysql的数据目录:
sudo mkdir /usr/local/mysql/datadir
编辑MySQL的配置文件:
sudo nano /etc/my.cnf
在配置文件中,添加以下内容:
[mysqld] basedir=/usr/local/mysql/binlog_basedir_testdb_testtable_testindex_testcharset_testcollation_testtimezone_testsystemvars_testrelaylog_testbinlog_testslave_testgtid_testrelayloginfo_testinnodb_file_per_table_testinnodb_file_per_table_data_home_dir=/usr/local/mysql/datadir/mysqldatahomedir_testdb_testtable_testindex_testcharset_testcollation_testtimezone_testsystemvars_testrelaylog_testbinlog_testslave_testgtid_testrelayloginfo_testinnodb_file_per_table_testinnodb_file_per_table_data_homedir=/usr/local/mysql/datadir/mysqldatahomedir_testdb_testtable_testindex_testcharset_testcollation_testtimezone_testsystemvars_testrelaylog_testbinlog_testslave_testgtid_testrelayloginfo_testinnodb_file_per_table=1 datadir=/usr/local/mysql/datadir log-error=/var/log/mysqld.err socket=/var/run/mysqld/mysqld.sock keyring-file=~/.mylogin.key server-id=1 port=3306 max-connections=200 threads=10 connections=10 wait-timeout=60 time-zone=SYSTEM datadir=/usr/local/mysql/datadir character-set-server=utf8 collation-server=utf8_general_ci init-connect='SET NAMES utf8' connect-timeout=10 local-infile=1 read-default-group-suffix=true sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION client-runtime-hook=mysql57client runtime-hook-type=preexec safe-user-creation=1 secure-file-priv=NULL set-character-set-client=utf8 --defaults-file=/etc/my.cnf skip-external-locking --skip-networking --sysconfile=/etc " --with-plugin-load="validate" --with-pam --with-extra-charsets --with-ssl --with-zlib --with-icu --without-networking --skip-autodebconf --skip-check "--with-osmpapi --with-embedded-server" --with-debug --with-assembler --enable-asl --enable-shared --disable-inline-optimization --with-plugin "validation" --with-plugin "audit" --with-plugin "blackhole" --with-plugin "cache" --with!--with-plugin "profiling" --with!--with-plugin "securityevents" --with!--with-plugin "xmlstub" --without-server "clustering" "--skipping network support" --skipping Aria and performance schema support --skipping InnoDB cluster support "--skipping XtraDB Cluster support" --skipping MyISAM tablespace support "--skipped networking support" "--skipped security events support" "--skipped performance schema support" "--skipped InnoDB cluster support" "--skipped XtraDB Cluster support" "--skipped MyISAM tablespace support" "--skipped networking support" "--skipped security events support" "--skipped performance schema support" "--skipped InnoDB cluster support" "--skipped XtraDB Cluster support" "--skipped MyISAM tablespace support" "--skipped networking support" "--skipped security events support" "--skipped performance schema support" "--skipped InnoDB cluster support" "--skipped XtraDB Cluster support" "--skipped MyISAM tablespace support" "--skipped networking support" "--skipped security events support" "--skipped performance schema support" "--skipped InnoDB cluster support" "--skipped XtraDB Cluster support" "--skipped MyISAM tablespace support" "--skipped networking support" "--skipped security events support" "--skipped performance schema support" "--skipped InnoDB cluster support" "--skipped XtraDB Cluster support" "--skipped MyISAM tablespace support" "--skipped networking support" "--skipped security events support "; exit; [FAILURE] [0] [Abort trap] 1; [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS] [0] [Exit status: 0] [OK] [root@localhost ~] exit; exit; [SUCCESS
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/165735.html