符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
这篇文章主要讲解了“Linux怎么用源码安装MySQL 5.7”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Linux怎么用源码安装MySQL 5.7”吧!
站在用户的角度思考问题,与客户深入沟通,找到凤县网站设计与凤县网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都做网站、网站制作、企业官网、英文网站、手机端网站、网站推广、域名申请、虚拟主机、企业邮箱。业务覆盖凤县地区。
有两种方法来使用源码安装MySQL:
.使用一种标准的MySQL源码安装。标准的可用源码文件被压缩成tar文件,zip文件或RPM包。文件名的格式为mysql-version.tar.gz,mysql-version.zip或mysql-version.rpm。其中version是版本号比例如5.7.25。发布的源码文件名与预先编译好的二进制文件名是有区别的,源码文件名通常不包含平台名,而二进制文件名包含平台名,例如pc-linux-i686或winx64。
.使用MySQL开发树。如何构建开发树将在使用开发源码树来安装MySQL中进行介绍。
使用源码安装MySQL操作系统所要满足的条件
使用源码来安装MySQL需要几个开发工具。无论您使用的是标准的源代码分发版还是开发源代码树,都需要这些工具中的一部分。是否需要其它工具依赖于你的安装方法。
为了使用源码来安装MySQL,不管使用何种安装方法下面的要求必须要满足:
.CMake,用来在所有平台上构建框架,可以从http://www.cmake.org来下载CMake。
.一个好的make程序,虽然一些平台有它们自己的make实现,但强烈建议使用GNU make 3.75或更高版本。它可能已经存在于你的系统中了gmake。可以从http://www.gnu.org/software/make/下载GNU make。
.ANSI C++编译器。可以对force_unsupported_compiler的描述。
.为了构建MySQL需要Boost C++库(但不使用它)。Boost 1.59.0必须被安装。为了获得Boost与它的安装指令,可以访问https://www.boost.org/网址。在Boost安装后,当调用CMake时通过使用WITH_BOOST选项来告诉构建系统在哪里定位Boost文件。
shell>cmake . -DWITH_BOOST=/usr/local/boost_1_59_0
根据实际情况来调整路径。
.ncurses库 https://www.gnu.org/software/ncurses/ncurses.html
.足够的空闲内存。当编译很大的源文件时如果遇到了"internal compiler error"错误,那么可能是因为你没有足够的内存。如果在一个虚拟机上进行编译,尝试增加内存分配。
.如果你希望运行测试脚本那么就需要安装perl。大多数像Unix的系统已经包含了perl。在windows上可以使用ActiveState Perl。
为了使用标准的源码发布版本来安装MySQL,需要以下一种工具来解压发布的源码文件:
.对于一个.tar.gz的压缩tar文件,GNU gunzip可以用来解压tar用来unpack。如果你的tar程序支持z选项,它可以用来解压与 unpack文件。GNU tar众所周知是有效的。一些操作系统提供的标准tar不能对MySQL发布版本的长文件名进行unpack操作。你应该安装GUN tar或者可能的话,使用预安装版本的GNU tar。常用的有gnutar,gtar,tar或者自由软件目录,比如/usr/sfw/bin或/usr/local/bin。GNU tar可以从http://www.gnu.org/software/tar/进行下载。
.对于一个.zip归档文件,winzip或另外的工具可以读取.zip文件。
.对于一个.rpm的RPM包,rpmbuild程序用来对构建的发布版本进行unpack操作。
为了使用开发源码树来安装MySQL,需要安装以下额外的工具:
.需要Git版本控制系统来获得开发源代码。https://help.github.com/en提供了指令在不同平台上下载与安装Git。MySQL官方组织已经于2014年9月加入了GitHub。
.bison 2.1或更高版本,可以从http://www.gnu.org/software/bison/网址进行下载(1版本不再支持),尽可能的使用最新版本,如果你遇到了问题,那么升级到最新的版本,而不是回退到更早的版本。
bison可以从http://www.gnu.org/software/bison/网址进行下载,对于Windows平台可以从http://gnuwin32.sourceforge.net/packages/bison.htm网址进行下载。在Windows平台上,bison的缺省目录是C:\Program Files\GnuWin32目录。有一些工具可以在查找bison会失败,因为在目录名中存在空隔。同样,Visual Studio如果在路径中存在空隔可能会出现hang住。为了解决这种问题的出现,可以将bison安装到C:\GnuWin32目录。
.在Solaris平台上,除了bison之外m4必须被安装。m4可以从http://www.gnu.org/software/m4/网址下载。
注意在安装任何程序之后,需要修改你的PATH环境变量来包含定位程序的目录。
源码安装MySQL的布局
缺省情况下,当使用源码编译后安装MySQL,安装操作会将文件安装在/usr/local/mysql目录中。这与使用二进制文件安装的安装目录是一样的。
使用标准源码安装MySQL
1.安装所需要的工具包
[root@localhost ~]# yum -y install gcc* gcc-c++ ncurses* ncurses-devel* cmake* bison* libgcrypt* perl* make* ....... 已安装: gcc-gnat.x86_64 0:4.8.5-36.0.1.el7 gcc-objc.x86_64 0:4.8.5-36.0.1.el7 gcc-objc++.x86_64 0:4.8.5-36.0.1.el7 libgcrypt-devel.x86_64 0:1.5.3-14.el7 ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 ncurses-term.noarch 0:5.9-14.20130511.el7_4 perl-Algorithm-Diff.noarch 0:1.1902-17.el7 perl-App-cpanminus.noarch 0:1.6922-2.el7 perl-Archive-Extract.noarch 1:0.68-3.el7 perl-Archive-Zip.noarch 0:1.30-11.el7 perl-Authen-SASL.noarch 0:2.15-10.el7 perl-B-Lint.noarch 0:1.17-3.el7 perl-Bit-Vector.x86_64 0:7.3-3.el7 perl-CGI.noarch 0:3.63-4.el7 perl-CGI-Session.noarch 0:4.35-16.el7 perl-CPAN.noarch 0:1.9800-293.el7 perl-CPAN-Meta.noarch 0:2.120921-5.el7 perl-CPAN-Meta-Requirements.noarch 0:2.122-7.el7 perl-CPAN-Meta-YAML.noarch 0:0.008-14.el7 perl-CPANPLUS.noarch 0:0.91.38-4.el7 perl-CPANPLUS-Dist-Build.noarch 0:0.70-3.el7 perl-Carp-Clan.noarch 0:6.04-10.el7 perl-Class-ISA.noarch 0:0.36-1010.el7 perl-Class-Load.noarch 0:0.20-3.el7 perl-Class-Singleton.noarch 0:1.4-14.el7 perl-Convert-ASN1.noarch 0:0.26-4.el7 perl-DBD-MySQL.x86_64 0:4.023-6.0.1.el7 perl-DBD-Pg.x86_64 0:2.19.3-4.el7 perl-DBIx-Simple.noarch 0:1.35-7.el7 perl-Data-OptList.noarch 0:0.107-9.el7 perl-Date-Calc.noarch 0:6.3-14.el7 perl-Date-Manip.noarch 0:6.41-2.el7 perl-DateTime.x86_64 2:1.04-6.el7 perl-DateTime-Format-DateParse.noarch 0:0.05-5.el7 perl-DateTime-Locale.noarch 0:0.45-6.el7 perl-DateTime-TimeZone.noarch 0:1.70-1.el7 perl-Devel-Symdump.noarch 1:2.10-2.el7 perl-Digest-SHA1.x86_64 0:2.13-9.el7 perl-Env.noarch 0:1.04-2.el7 perl-ExtUtils-CBuilder.noarch 1:0.28.2.6-293.el7 perl-ExtUtils-Embed.noarch 0:1.30-293.el7 perl-FCGI.x86_64 1:0.74-8.el7 perl-File-CheckTree.noarch 0:4.42-3.el7 perl-File-Fetch.noarch 0:0.42-2.el7 perl-Font-AFM.noarch 0:1.20-13.el7 perl-FreezeThaw.noarch 0:0.5001-10.el7 perl-GD.x86_64 0:2.49-3.el7 perl-GSSAPI.x86_64 0:0.28-9.el7 perl-HTML-Format.noarch 0:2.10-7.el7 perl-HTML-Tree.noarch 1:5.03-2.el7 perl-IO-stringy.noarch 0:2.110-22.el7 perl-IPC-Cmd.noarch 1:0.80-4.el7 perl-JSON.noarch 0:2.59-2.el7 perl-JSON-PP.noarch 0:2.27202-2.el7 perl-LDAP.noarch 1:0.56-6.el7 perl-LWP-Protocol-https.noarch 0:6.04-4.el7 perl-List-MoreUtils.x86_64 0:0.33-9.el7 perl-Locale-Codes.noarch 0:3.26-2.el7 perl-Locale-Maketext.noarch 0:1.23-3.el7 perl-Locale-Maketext-Simple.noarch 1:0.21-293.el7 perl-Log-Message.noarch 1:0.08-3.el7 perl-Log-Message-Simple.noarch 0:0.10-2.el7 perl-Module-Build.noarch 2:0.40.05-2.el7 perl-Module-CoreList.noarch 1:2.76.02-293.el7 perl-Module-Implementation.noarch 0:0.06-6.el7 perl-Module-Load.noarch 1:0.24-3.el7 perl-Module-Load-Conditional.noarch 0:0.54-3.el7 perl-Module-Loaded.noarch 1:0.08-293.el7 perl-Module-Metadata.noarch 0:1.000018-2.el7 perl-Module-Pluggable.noarch 1:4.8-3.el7 perl-Module-Runtime.noarch 0:0.013-4.el7 perl-Module-Signature.noarch 0:0.73-2.el7 perl-Mozilla-CA.noarch 0:20130114-5.el7 perl-Newt.x86_64 0:1.08-36.el7 perl-Object-Accessor.noarch 1:0.42-293.el7 perl-PAR-Dist.noarch 0:0.49-2.el7 perl-Package-DeprecationManager.noarch 0:0.13-7.el7 perl-Package-Stash.noarch 0:0.34-2.el7 perl-Package-Stash-XS.x86_64 0:0.26-3.el7 perl-Params-Check.noarch 1:0.38-2.el7 perl-Params-Util.x86_64 0:1.07-6.el7 perl-Params-Validate.x86_64 0:1.08-4.el7 perl-Parse-CPAN-Meta.noarch 1:1.4404-5.el7 perl-Perl-OSType.noarch 0:1.003-3.el7 perl-Perl4-CoreLibs.noarch 0:0.003-7.el7 perl-Pod-Checker.noarch 0:1.60-2.el7 perl-Pod-Coverage.noarch 0:0.23-3.el7 perl-Pod-LaTeX.noarch 0:0.61-2.el7 perl-Pod-Parser.noarch 0:1.61-2.el7 perl-Pod-Plainer.noarch 0:1.03-4.el7 perl-SGMLSpm.noarch 0:1.03ii-31.el7 perl-SNMP_Session.noarch 0:1.13-5.el7 perl-String-ShellQuote.noarch 0:1.04-10.el7 perl-Sub-Install.noarch 0:0.926-6.el7 perl-Sys-CPU.x86_64 0:0.54-4.el7 perl-Sys-Guestfs.x86_64 1:1.38.2-12.0.1.el7 perl-Sys-MemInfo.x86_64 0:0.91-7.el7 perl-Sys-Virt.x86_64 0:4.5.0-2.el7 perl-Term-UI.noarch 0:0.36-2.el7 perl-Test-Pod.noarch 0:1.48-3.el7 perl-Test-Pod-Coverage.noarch 0:1.08-21.el7 perl-Test-Simple.noarch 0:0.98-243.el7 perl-Text-Diff.noarch 0:1.41-5.el7 perl-Text-Soundex.x86_64 0:3.04-4.el7 perl-Text-Unidecode.noarch 0:0.04-20.el7 perl-Time-Piece.x86_64 0:1.20.1-293.el7 perl-Try-Tiny.noarch 0:0.12-2.el7 perl-Version-Requirements.noarch 0:0.101022-244.el7 perl-XML-Dumper.noarch 0:0.81-17.el7 perl-XML-Filter-BufferText.noarch 0:1.01-17.el7 perl-XML-Grove.noarch 0:0.46alpha-52.el7 perl-XML-SAX-Writer.noarch 0:0.53-4.el7 perl-XML-Twig.noarch 0:3.44-2.el7 perl-XML-Writer.noarch 0:0.623-3.el7 perl-XML-XPath.noarch 0:1.13-22.el7 perl-YAML.noarch 0:0.84-5.el7 perl-YAML-Tiny.noarch 0:1.51-6.el7 perl-autodie.noarch 0:2.16-2.el7 perl-core.x86_64 0:5.16.3-293.el7 perl-gettext.x86_64 0:1.05-28.el7 perl-homedir.noarch 0:1.008010-4.el7 perl-libintl.x86_64 0:1.20-12.el7 perl-libxml-perl.noarch 0:0.08-19.el7 perl-local-lib.noarch 0:1.008010-4.el7 perltidy.noarch 0:20121207-3.el7 作为依赖被安装: glusterfs-cli.x86_64 0:3.12.2-18.el7 glusterfs-client-xlators.x86_64 0:3.12.2-18.el7 libgnat.x86_64 0:4.8.5-36.0.1.el7 libgnat-devel.x86_64 0:4.8.5-36.0.1.el7 libgpg-error-devel.x86_64 0:1.12-3.el7 libobjc.x86_64 0:4.8.5-36.0.1.el7 libvirt-bash-completion.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage-core.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage-disk.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage-gluster.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage-iscsi.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage-logical.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage-mpath.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage-rbd.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage-scsi.x86_64 0:4.5.0-10.el7 libvirt-libs.x86_64 0:4.5.0-10.el7 openjade.x86_64 0:1.3.2-45.el7 opensp.x86_64 0:1.5.2-19.el7 pcp-selinux.x86_64 0:4.1.0-4.el7 postgresql-libs.x86_64 0:9.2.24-1.el7_5 squashfs-tools.x86_64 0:4.3-0.21.gitaae0aff4.el7 更新完毕: bison.x86_64 0:3.0.4-2.el7 gcc.x86_64 0:4.8.5-36.0.1.el7 gcc-c++.x86_64 0:4.8.5-36.0.1.el7 gcc-gfortran.x86_64 0:4.8.5-36.0.1.el7 libgcrypt.x86_64 0:1.5.3-14.el7 make.x86_64 1:3.82-23.el7 ncurses.x86_64 0:5.9-14.20130511.el7_4 ncurses-base.noarch 0:5.9-14.20130511.el7_4 ncurses-libs.x86_64 0:5.9-14.20130511.el7_4 perl.x86_64 4:5.16.3-293.el7 perl-Digest-SHA.x86_64 1:5.85-4.el7 perl-ExtUtils-Install.noarch 0:1.58-293.el7 perl-ExtUtils-ParseXS.noarch 1:3.18-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7 perl-Git.noarch 0:1.8.3.1-19.el7 perl-HTTP-Daemon.noarch 0:6.01-8.el7 perl-IO-Socket-IP.noarch 0:0.21-5.el7 perl-IO-Socket-SSL.noarch 0:1.94-7.el7 perl-IO-Zlib.noarch 1:1.10-293.el7 perl-Net-DNS.x86_64 0:0.72-6.el7 perl-Net-SSLeay.x86_64 0:1.55-6.el7 perl-PCP-PMDA.x86_64 0:4.1.0-4.el7 perl-Package-Constants.noarch 1:0.02-293.el7 perl-Pod-Escapes.noarch 1:1.04-293.el7 perl-Socket.x86_64 0:2.010-4.el7 perl-Test-Harness.noarch 0:3.28-3.el7 perl-devel.x86_64 4:5.16.3-293.el7 perl-hivex.x86_64 0:1.3.10-6.9.el7 perl-libs.x86_64 4:5.16.3-293.el7 perl-macros.x86_64 4:5.16.3-293.el7 perl-version.x86_64 3:0.99.07-3.el7 作为依赖被升级: cpp.x86_64 0:4.8.5-36.0.1.el7 git.x86_64 0:1.8.3.1-19.el7 glusterfs.x86_64 0:3.12.2-18.el7 glusterfs-api.x86_64 0:3.12.2-18.el7 glusterfs-fuse.x86_64 0:3.12.2-18.el7 glusterfs-libs.x86_64 0:3.12.2-18.el7 glusterfs-rdma.x86_64 0:3.12.2-18.el7 hivex.x86_64 0:1.3.10-6.9.el7 libgcc.x86_64 0:4.8.5-36.0.1.el7 libgfortran.x86_64 0:4.8.5-36.0.1.el7 libgomp.x86_64 0:4.8.5-36.0.1.el7 libguestfs.x86_64 1:1.38.2-12.0.1.el7 libquadmath.x86_64 0:4.8.5-36.0.1.el7 libquadmath-devel.x86_64 0:4.8.5-36.0.1.el7 libstdc++.x86_64 0:4.8.5-36.0.1.el7 libstdc++-devel.x86_64 0:4.8.5-36.0.1.el7 libvirt.x86_64 0:4.5.0-10.el7 libvirt-client.x86_64 0:4.5.0-10.el7 libvirt-daemon.x86_64 0:4.5.0-10.el7 libvirt-daemon-config-network.x86_64 0:4.5.0-10.el7 libvirt-daemon-config-nwfilter.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-interface.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-lxc.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-network.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-nodedev.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-nwfilter.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-qemu.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-secret.x86_64 0:4.5.0-10.el7 libvirt-daemon-driver-storage.x86_64 0:4.5.0-10.el7 libvirt-daemon-kvm.x86_64 0:4.5.0-10.el7 openssl.x86_64 1:1.0.2k-16.0.1.el7 openssl-libs.x86_64 1:1.0.2k-16.0.1.el7 pcp.x86_64 0:4.1.0-4.el7 pcp-conf.x86_64 0:4.1.0-4.el7 pcp-libs.x86_64 0:4.1.0-4.el7 python-pcp.x86_64 0:4.1.0-4.el7 supermin5.x86_64 0:5.1.19-1.el7 完毕!
2.使用命令检查是否安装有MySQL Server包
[root@localhost ~]# rpm -qa | grep mysql [root@localhost ~]# rpm -aq | grep mysql mysql-community-libs-5.6.23-3.el7.x86_64 qt-mysql-4.8.5-8.0.1.el7.x86_64 akonadi-mysql-1.9.2-4.0.1.el7.x86_64 mysql-community-common-5.6.23-3.el7.x86_64 mysql-community-server-5.6.23-3.el7.x86_64 mysql-community-client-5.6.23-3.el7.x86_64
删除操作有以下两种
rpm -e mysql-libs //普通删除模式
rpm -e --nodeps mysql-lib// 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
[root@localhost ~]# rpm -e --nodeps mysql-community-libs [root@localhost ~]# rpm -e --nodeps akonadi-mysql [root@localhost ~]# rpm -e --nodeps mysql-community-common [root@localhost ~]# rpm -e --nodeps mysql-community-server [root@localhost ~]# rpm -e --nodeps mysql-community-client [root@localhost ~]# rpm -e --nodeps qt-mysql [root@localhost ~]# rpm -aq | grep mysql
3.下载源码文件mysql-5.7.26.tar.gz并上传到服务器的/soft目录中
[root@localhost soft]# ls -lrt 总用量 79960 -rw-r--r--. 1 root root 54056899 5月 30 16:36 mysql-5.7.26.tar.gz
4.下载boost包并上传到服务器的/soft目录中
5. 创建mysql用户与用户组
[root@localhost /]# groupadd mysql [root@localhost /]# useradd -r -g mysql -s /bin/false mysql
因为用户只用于所有权目的,而不是登录目的,useradd命令使用-r与-s /bin/false选项来创建一个用户没有登录服务器主机的权限。
6.创建并修改/mysqlsoft/mysql与/mysqldata/mysql目录权限
[root@localhost /]# mkdir -p /mysqlsoft/mysql [root@localhost /]# mkdir -p /mysqldata/mysql [root@localhost /]# chown -R mysql:mysql /mysqlsoft [root@localhost /]# chown -R mysql:mysql /mysqldata/mysql [root@localhost /]# chmod -R 775 /mysqlsoft/mysql [root@localhost /]# chmod -R 775 /mysqldata/mysql
7.解压boost软件包与MySQL源码包
[root@localhost soft]# unzip boost_1_59_0.zip [root@localhost soft]# ls -lrt 总用量 201556 drwx------. 8 root root 4096 8月 12 2015 boost_1_59_0 -rw-r--r--. 1 root root 54056899 5月 30 16:36 mysql-5.7.26.tar.gz -rw-r--r--. 1 root root 124506259 6月 13 21:07 boost_1_59_0.zip
将MySQL文件解压到/soft目录下
[root@localhost soft]# tar zxvf mysql-5.7.26.tar.gz [root@localhost soft]# ls -lrt 总用量 201560 drwx------. 8 root root 4096 8月 12 2015 boost_1_59_0 drwxr-xr-x. 35 7161 31415 4096 4月 13 21:46 mysql-5.7.26 -rw-r--r--. 1 root root 54056899 5月 30 16:36 mysql-5.7.26.tar.gz -rw-r--r--. 1 root root 27816900 6月 10 11:32 docker-17.03.0-ce.tgz -rw-r--r--. 1 root root 124506259 6月 13 21:07 boost_1_59_0.zip 总用量 4 [root@localhost soft]# chown -R mysql:mysql mysql-5.7.26 [root@localhost soft]# chmod -R 775 mysql-5.7.26
8.预编译MySQL
[root@localhost soft]# su - mysql 上一次登录:一 6月 17 12:21:54 CST 2019pts/0 上 -bash-4.2$ cd /soft/mysql-5.7.26/ -bash-4.2$ cmake . -DCMAKE_INSTALL_PREFIX=/mysqlsoft/mysql \ > -DMYSQL_DATADIR=/mysqldata/mysql \ > -DMYSQL_UNIX_ADDR=/mysqlsoft/mysql/mysql.sock \ > -DWITH_BOOST=../boost_1_59_0 \ > -DWITH_INNOBASE_STORAGE_ENGINE=1 \ > -DWITH_PARTITION_STORAGE_ENGINE=1 \ > -DWITH_FEDERATED_STORAGE_ENGINE=1 \ > -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ > -DWITH_MYISAM_STORAGE_ENGINE=1 \ > -DENABLED_LOCAL_INFILE=1 \ > -DENABLE_DTRACE=0 \ > -DDEFAULT_CHARSET=utf8mb4 \ > -DDEFAULT_COLLATION=utf8mb4_general_ci \ > -DWITH_EMBEDDED_SERVER=1 .................... -- Found PkgConfig: /bin/pkg-config (found version "0.27.1") -- checking for module 'libtirpc' -- package 'libtirpc' not found -- Performing Test HAVE_STRUCT_SOCKADDR_SA_LEN -- Performing Test HAVE_STRUCT_SOCKADDR_SA_LEN - Failed -- Performing Test HAVE_STRUCT_IFREQ_IFR_NAME -- Performing Test HAVE_STRUCT_IFREQ_IFR_NAME - Success -- Performing Test HAVE_XDR_OPS_X_PUTINT32 -- Performing Test HAVE_XDR_OPS_X_PUTINT32 - Success -- Performing Test HAVE_XDR_OPS_X_GETINT32 -- Performing Test HAVE_XDR_OPS_X_GETINT32 - Success -- Performing Test HAVE___CONST -- Performing Test HAVE___CONST - Success -- Performing Test HAVE_RPC_INLINE_T -- Performing Test HAVE_RPC_INLINE_T - Failed -- Performing Test OLD_XDR -- Performing Test OLD_XDR - Failed -- Performing Test X_GETPOSTN_NOT_USE_CONST -- Performing Test X_GETPOSTN_NOT_USE_CONST - Success -- Performing Test HAS_INCOMPATIBLE_POINTER_TYPES -- Performing Test HAS_INCOMPATIBLE_POINTER_TYPES - Failed -- Performing Test X_PUTLONG_NOT_USE_CONST -- Performing Test X_PUTLONG_NOT_USE_CONST - Failed -- checking for module 'libtirpc' -- package 'libtirpc' not found -- RPC_INCLUDE_DIRS /usr/include -- Using Boost headers from /soft/boost_1_59_0 -- Performing Test CXX_HAVE_SIGN_COMPARE -- Performing Test CXX_HAVE_SIGN_COMPARE - Success -- Performing Test CXX_HAVE_UNUSED_VARIABLE -- Performing Test CXX_HAVE_UNUSED_VARIABLE - Success -- MYSQLX - Text log of protobuf messages enabled -- Performing Test HAVE_UNUSED_PARAMETER -- Performing Test HAVE_UNUSED_PARAMETER - Success -- Googletest was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source. -- If you are inside a firewall, you may need to use an https proxy: export https_proxy=http://example.com:80 -- Performing Test HAVE_MISLEADING_INDENTATION -- Performing Test HAVE_MISLEADING_INDENTATION - Failed -- executable target mysqld debug_target /soft/debug/sql/mysqld -- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl -- MERGE_CONVENIENCE_LIBRARIES TARGET mysqlserver -- MERGE_CONVENIENCE_LIBRARIES LIBS dbug;strings;regex;mysys;mysys_ssl;vio;zlib;yassl;taocrypt;crypt;dl;archive_embedded;blackhole_embedded;csv_embedded;federated_embedded;heap_embedded;innobase_embedded;lz4_lib;myisam_embedded;myisammrg_embedded;partition_embedded;ngram_parser_embedded;sql_embedded -- MERGE_CONVENIENCE_LIBRARIES MYLIBS dbug;strings;regex;mysys;mysys_ssl;vio;zlib;yassl;taocrypt;archive_embedded;blackhole_embedded;csv_embedded;federated_embedded;heap_embedded;innobase_embedded;lz4_lib;myisam_embedded;myisammrg_embedded;partition_embedded;ngram_parser_embedded;sql_embedded -- library target mysqlserver debug_target /soft/debug/archive_output_directory/libmysqld.a -- INSTALL mysqlclient.pc lib/pkgconfig -- Skipping deb packaging on unsupported platform . -- CMAKE_BUILD_TYPE: RelWithDebInfo -- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H;HAVE_LIBEVENT2 -- CMAKE_C_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement -- CMAKE_CXX_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -- CMAKE_C_LINK_FLAGS: -- CMAKE_CXX_LINK_FLAGS: -- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF -- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF -- Configuring done -- Generating done -- Build files have been written to: /soft/mysql-5.7.26
9.编译源码,这时使用-j 6选项来使用6个进程同时进行编译
-bash-4.2$ make -j 6 ......... Building CXX object sql/CMakeFiles/sql.dir/event_data_objects.cc.o Building CXX object sql/CMakeFiles/sql.dir/des_key_file.cc.o Building CXX object sql/CMakeFiles/sql.dir/event_db_repository.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/event_parse_data.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/event_queue.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/event_scheduler.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/events.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/mf_iocache.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/mysqld.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/mysqld_thd_manager.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/protocol_callback.cc.o [ 97%] Building CXX object sql/CMakeFiles/sql.dir/signal_handler.cc.o [ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_audit.cc.o [ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_client.cc.o [ 98%] Building CXX object sql/CMakeFiles/sql.dir/srv_session.cc.o [ 98%] Building CXX object sql/CMakeFiles/sql.dir/srv_session_info_service.cc.o [ 98%] Building CXX object sql/CMakeFiles/sql.dir/srv_session_service.cc.o [ 98%] Building CXX object sql/CMakeFiles/sql.dir/auth/sha2_password_common.cc.o [ 98%] Building CXX object sql/CMakeFiles/sql.dir/mysqld_daemon.cc.o Linking CXX static library ../archive_output_directory/libsql.a [ 98%] Built target sql Scanning dependencies of target mysqld Scanning dependencies of target pfs_connect_attr-t [ 99%] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.o Linking CXX executable mysqld [100%] [100%] [100%] Building CXX object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/__/__/__/sql/sql_builtin.cc.o Building CXX object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/pfs_connect_attr-t.cc.o Building C object storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/__/__/__/mysys/string.c.o Linking CXX executable pfs_connect_attr-t [100%] Built target mysqld [100%] Built target pfs_connect_attr-t
10.安装
-bash-4.2$ make install ................. -- Installing: /mysqlsoft/mysql/mysql-test/./t/wl6661.test -- Installing: /mysqlsoft/mysql/mysql-test/./t/wl6711_heap_to_disk.test -- Installing: /mysqlsoft/mysql/mysql-test/./t/wl6978.test -- Installing: /mysqlsoft/mysql/mysql-test/./t/xa.test -- Installing: /mysqlsoft/mysql/mysql-test/./t/xa_debug.test -- Installing: /mysqlsoft/mysql/mysql-test/./t/xa_gtid-master.opt -- Installing: /mysqlsoft/mysql/mysql-test/./t/xa_gtid.test -- Installing: /mysqlsoft/mysql/mysql-test/./t/xa_prepared_binlog_off-master.opt -- Installing: /mysqlsoft/mysql/mysql-test/./t/xa_prepared_binlog_off.test -- Installing: /mysqlsoft/mysql/mysql-test/./t/xml.test -- Installing: /mysqlsoft/mysql/mysql-test/./valgrind.supp -- Installing: /mysqlsoft/mysql/mysql-test/./mtr -- Installing: /mysqlsoft/mysql/mysql-test/./mysql-test-run -- Installing: /mysqlsoft/mysql/mysql-test/./Makefile -- Installing: /mysqlsoft/mysql/mysql-test/./cmake_install.cmake -- Installing: /mysqlsoft/mysql/mysql-test/./CTestTestfile.cmake -- Installing: /mysqlsoft/mysql/./COPYING-test -- Installing: /mysqlsoft/mysql/./README-test -- Up-to-date: /mysqlsoft/mysql/mysql-test/mtr -- Up-to-date: /mysqlsoft/mysql/mysql-test/mysql-test-run -- Installing: /mysqlsoft/mysql/mysql-test/lib/My/SafeProcess/my_safe_process -- Up-to-date: /mysqlsoft/mysql/mysql-test/lib/My/SafeProcess/my_safe_process -- Installing: /mysqlsoft/mysql/mysql-test/lib/My/SafeProcess/Base.pm -- Installing: /mysqlsoft/mysql/support-files/mysqld_multi.server -- Installing: /mysqlsoft/mysql/support-files/mysql-log-rotate -- Installing: /mysqlsoft/mysql/support-files/magic -- Installing: /mysqlsoft/mysql/share/aclocal/mysql.m4 -- Installing: /mysqlsoft/mysql/support-files/mysql.server [root@localhost mysqlsoft]# chmod -R 775 mysql
11.配置mysql参数,只是设置几个简单的mysql运行参数
[root@localhost mysql]# vi /mysqlsoft/mysql/my.cnf [mysqld] basedir=/mysqlsoft/mysql datadir=/mysqldata/mysql bind-address=0.0.0.0 user=mysql port=3306 log-error=/mysqldata/mysql/mysql.err pid-file=/mysqldata/mysql/mysqld.pid socket = /mysqlsoft/mysql/mysql.sock character-set-server=utf8mb4 default-storage-engine=INNODB explicit_defaults_for_timestamp = true [root@localhost mysql]# cd bin [root@localhost bin]# ./mysqld --defaults-file=/mysqlsoft/mysql/my.cnf --initialize --basedir=/mysqlsoft/mysql --datadir=/mysqldata/mysql --user=mysql
查看日志信息
[root@localhost mysql]# tail -f mysql.err 2019-06-17T06:28:34.137849Z 0 [Warning] InnoDB: New log files created, LSN=45790 2019-06-17T06:28:35.342112Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2019-06-17T06:28:35.465187Z 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: 2296e390-90c9-11e9-9a9f-005056a390e6. 2019-06-17T06:28:35.471829Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2019-06-17T06:28:35.474533Z 1 [Note] A temporary password is generated for root@localhost: Ldp#HUPR(7hH
其中[Note] A temporary password is generated for root@localhost:后面跟的是mysql数据库登录的临时密码,各人安装生成的临时密码不一样。可以看到到日志文件没有报错,而且有了临时密码,表示初始化成功。
12.如果想服务能够部署自动支持安全连接,使用mysql_ssl_rsa_setup工具来创建缺省SSL与RSA文件
[root@localhost bin]# ./mysql_ssl_rsa_setup --datadir=/mysqldata/mysql Generating a 2048 bit RSA private key ...........................+++ .......+++ writing new private key to 'ca-key.pem' ----- Generating a 2048 bit RSA private key .......................................................................................................+++ ...................................................................................................................................................+++ writing new private key to 'server-key.pem' ----- Generating a 2048 bit RSA private key .....................................+++ ...........+++ writing new private key to 'client-key.pem' -----
13.启动MySQL
[root@localhost bin]# ./mysqld_safe --user=mysql & [1] 19442 [root@localhost bin]# 2019-06-17T06:34:01.654203Z mysqld_safe Logging to '/mysqldata/mysql/mysql.err'. 2019-06-17T06:34:01.750954Z mysqld_safe Starting mysqld daemon with databases from /mysqldata/mysql
14.配置自动启动MySQL
[root@localhost ~]# cp /mysqlsoft/mysql/support-files/mysql.server /etc/init.d/mysqld [root@localhost ~]# chmod 755 /etc/init.d/mysqld [root@localhost ~]# systemctl enable mysqld mysqld.service is not a native service, redirecting to /sbin/chkconfig. Executing /sbin/chkconfig mysqld on
14.配置环境变量
[root@localhost ~]# vi /etc/profile # /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc # It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates. export MYSQL_HOME=/mysqlsoft/mysql/ export PATH=$PATH:$MYSQL_HOME/bin
15.登录MySQL并修改root用户密码
-bash-4.2$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.26 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> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.00 sec)
到此使用源码来安装MySQL就完成了。
感谢各位的阅读,以上就是“Linux怎么用源码安装MySQL 5.7”的内容了,经过本文的学习后,相信大家对Linux怎么用源码安装MySQL 5.7这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!