Preparations before compiling and installing MySQL
Uninstall mariadb;
yum -y remove mariadb*;
Dependencies Resolved
===============================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================
Removing:
mariadb-libs x86_64 1:5.5.52-1.el7 @anaconda 4.4 M
Removing for dependencies:
postfix x86_64 2:2.10.1-6.el7 @anaconda 12 M
Transaction Summary
===============================================================================================================================
Remove 1 Package (+1 Dependent package)
Installed size: 17 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : 2:postfix-2.10.1-6.el7.x86_64 1/2
Erasing : 1:mariadb-libs-5.5.52-1.el7.x86_64 2/2
Verifying : 2:postfix-2.10.1-6.el7.x86_64 1/2
Verifying : 1:mariadb-libs-5.5.52-1.el7.x86_64 2/2
Removed:
mariadb-libs.x86_64 1:5.5.52-1.el7
Dependency Removed:
postfix.x86_64 2:2.10.1-6.el7
Complete!
Install the tools and libraries needed to compile source code
Additional knowledge points: lib Library, dev Development, gdb Debugging. Running installation lib,Compile dev,Commissioning assembly gdb;
c/c++Compiler:
yum install gcc;
yum install gcc-c++ ;
//Note: Using the yum command to install the dependency packages is not necessary.
gcc Dependency packages:
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
gcc x86_64 4.8.5-11.el7 base 16 M
Installing for dependencies:
cpp x86_64 4.8.5-11.el7 base 5.9 M
libmpc x86_64 1.0.1-3.el7 base 51 k
g++Dependency packages:
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
gcc-c++ x86_64 4.8.5-11.el7 base 7.2 M
Installing for dependencies:
libstdc++-devel x86_64 4.8.5-11.el7 base 1.5 M
yum install ncurses-devel
perl Generally installed are:
yum install perl
Install ntfs-3g:
wget ntfs-3g address, I am a copy of the official website link; Tar-xzvf file name; if it is GUI interface, it can be extracted directly; ./configure make make install; Manntfs-3g test is used to see if it has been installed. Then mount;
Mount ntfs file system u disk:
There are two ways on the internet: one is to install the kernel module; mount /dev/sdb1 /mnt/usb -t ntfs; The other is on the premise that ntfs-3g is installed: mount -t ntfs-3g /dev/sdb1 /mnt/usb Note: If the prompt does not / mnt/usb does not have this directory, use mkdir /mnt/usb to create a directory.
Install cmake.
The first method is: wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz tar -xzvf cmake-2.8.10.2.tar.gz cd cmake-2.8.10.2 ./bootstrap ; make ; make install ; man cmake; The second method: yum search cmake*; yum install. Mancmake is used to test whether the installation is successful.
Install rpmbuild:
yum search rpm-build;
//If there is rpm-build, execute the following statement;
yum install rpm-build.x86_64;
Dependencies Resolved
======================================================================================
Package Arch Version Repository Size
======================================================================================
Installing:
rpm-build x86_64 4.11.3-21.el7 base 145 k
Installing for dependencies:
dwz x86_64 0.11-3.el7 base 99 k
patch x86_64 2.7.1-8.el7 base 110 k
perl-srpm-macros noarch 1-8.el7 base 4.6 k
redhat-rpm-config noarch 9.1.0-72.el7.centos base 78 k
Transaction Summary
=========================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 436 k
Installed size: 918 k
Setting up MySQL Users and Groups
The version of mysql I use (if the connection does not fail, you can download it. This is the mysql official link): mysql-community-5.7.18-1.el7.src.rpm
Added mysql user group: groupadd mysql Added mysql user: useradd -r -g mysql -s /bin/false mysql
III. Installation of boost
Method 1: (This method is not very good, incomplete, choose method 2) The decompressed files will be generated in the rpmbuild directory. 7) Enter / home/rpmbuild/BUILD/mysql.5.7.18/boost_1_59_0/ Here we start compiling and installing boost_1_59_0. 8)./bootstrap.sh; Execution. / bootstrap.sh appears: Method two: Download boost_1_59_0 on the official website. tar -zxvf boost_1_59_0 cd boost_1_59_0 ./bootstrap.sh --with-libraries=system,filesystem,log,thread --with-toolset=gcc ./b2 toolset=gcc cxxflags="-std=c++11" ./b2 install --prefix=/usr/local/boost
[root@localhost boost_1_59_0]# ./bootstrap.sh;
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version... 2.7
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/build/doc/html/index.html
[root@localhost boost_1_59_0]#
Running. / b2 has the following problems (note: no errors, jump to step 12) and start executing: ./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory and libs/iostreams/src/bzip2.cpp:20:56: error: bzlib.h: No file or directory That is to say, there are many errors related to bz and Python libraries in the installation process. The solutions are as follows: 9)yum install bzip2-devel.x86_64; 10)yum install python-devel; After installing the library 11) Delete all files under / root/rpmbuild/BUILD / and execute again from step 3; Until after running. / bootstrap.sh: The Boost C++ Libraries were successfully built! The following directory should be added to compiler include paths: /root/rpmbuild/BUILD/mysql-5.7.18/boost_1_59_0 The following directory should be added to linker library paths: /root/rpmbuild/BUILD/mysql-5.7.18/boost_1_59_0/stage/lib 12) Finally, install boost: ./b2 install --prefix=/usr/local 13) The necessary library boost for mysql is installed here.
4. Install mysql from here:
premise:First install the following four dependency packages:
libaio-devel is needed by mysql-community-5.7.18-1.el7.centos.x86_64
ncurses-devel is needed by mysql-community-5.7.18-1.el7.centos.x86_64
numactl-devel is need000000000000000000000ed by mysql-community-5.7.18-1.el7.centos.x86_64
openssl-devel is needed by mysql-community-5.7.18-1.el7.centos.x86_64
0)Execution steps after installing dependent packages in premises 1) ;
1)rpmbuild --rebuild --clean mysql-community-5.7.18-1.el7.src.rpm ;Step 1) Official website method;
//Execution steps1)Later on/root/rpmbuild/RPMS/Lower generation x86_64 Document:
//In file10Installable programs:
mysql-community-client-5.7.18-1.el7.centos.x86_64.rpm;
mysql-community-common-5.7.18-1.el7.centos.x86_64.rpm
mysql-community-devel-5.7.18-1.el7.centos.x86_64.rpm;
mysql-community-embedded-5.7.18-1.el7.centos.x86_64.rpm
mysql-community-embedded-compat-5.7.18-1.el7.centos.x86_64.rpm
mysql-community-embedded-devel-5.7.18-1.el7.centos.x86_64.rpm
mysql-community-libs-5.7.18-1.el7.centos.x86_64.rpm
mysql-community-libs-compat-5.7.18-1.el7.centos.x86_64.rpm
mysql-community-server-5.7.18-1.el7.centos.x86_64.rpm
mysql-community-test-5.7.18-1.el7.centos.x86_64.rpm
//Installation:
rpm -ivh mysql-community-{server,client,common,libs}-* ;
Configure and initialize mysql:
Start mysql: It is not this command that starts the service in service mysqld start # CentOS 7 and up. / bin / system CTL start mysqld. service; \ Start mysql service with this in CentOS and up; / bin / system CTL stop mysqld. service; \ close mysql service with this in CentOS and up; Official documents: A superuser account'root'@'localhost' is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command for RHEL, Oracle Linux, CentOS, and Fedora systems: A superuser account'root'@'localhost' is created, and a superuser's password is set and saved in the error log. In RHEL, Oracle Linux, CentOS, and Fedora systems, use the following commands to view: Note: temporary means temporary. grep 'temporary password' /var/log/mysqld.log mysql -u root -p # Enter password: Enter temporary password Mysql > ALTER USER'root'@'localhost' IDENTIFIED BY'MyNewPassword!'; # Modify the password, pay attention to the strength of the password, too weak to be passed;