Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to compile and install the latest MySQL 5.7.11 by CentOS6.5

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how CentOS6.5 compiles and installs the latest MySQL 5.7.11. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Work before installation:

1. Download the MySQL5.7.11 source code package from the official website, about 49m

2. Install the CentOS6.5 64-bit operating system. The update operating system is recommended so that it is the latest in this version

3. Yum-y install gcc gcc-c++ autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake libaio libaio-devel autoconf bzr bison libtool / / this is used by an individual when installing the old version, and related dependency packages

Formal installation of MySQL

1. Add MySQL users and groups

Groupadd mysql

Useradd-r-g mysql mysql

two。 Decompress the source package

Tar-zxvf mysql-5.7.11.tar.gz

3. Start to step on MySQL's pit.

Set up the directory compiled by make

Cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ / / MySQL installation file directory

-DMYSQL_DATADIR=/mysql/data\ / / MySQL data file directory

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\ / / sock file directory

-DDEFAULT_CHARSET=utf8\ / / character set setting

-DDEFAULT_COLLATION=utf8_general_ci\

-DEXTRA_CHARSETS=all\

-DENABLED_LOCAL_INFILE=1

4. Enter cmake into the decompressed source package

[root@zhangMySQL5711 mysql-5.7.11] # cmake\

>-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

>-DMYSQL_DATADIR=/mysql/data\

>-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\

>-DDEFAULT_CHARSET=utf8\

>-DDEFAULT_COLLATION=utf8_general_ci\

>-DEXTRA_CHARSETS=all\

>-DENABLED_LOCAL_INFILE=1

-- 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.4.7

-- The CXX compiler identification is GNU 4.4.7

-- 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

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info-done

-- Looking for SHM_HUGETLB

-- Looking for SHM_HUGETLB-found

-- Looking for sys/types.h

-- Looking for sys/types.h-found

-- Looking for stdint.h

-- Looking for stdint.h-found

-- Looking for stddef.h

-- Looking for stddef.h-found

-- Check size of void *

-- Check size of void *-done

-- SIZEOF_VOIDP 8

-- MySQL 5.7.11

-- Packaging as: mysql-5.7.11-Linux-x86_64

-- Looked for boost/version.hpp in and

-- BOOST_INCLUDE_DIR BOOST_INCLUDE_DIR-NOTFOUND

-- LOCAL_BOOST_DIR

-- LOCAL_BOOST_ZIP

Could not find (the correct version of) boost. / / there is a problem

-- MySQL currently requires boost_1_59_0

CMake Error at cmake/boost.cmake:81 (MESSAGE):

You can download it with-DDOWNLOAD_BOOST=1-DWITH_BOOST= / / requires boost support, which is different from version 5.6

This CMake script will look for boost in. If it is not there

It will download and unpack it (in that directory) for you.

If you are inside a firewall, you may need to use an http proxy:

Export http_proxy= http://example.com:80

Call Stack (most recent call first):

Cmake/boost.cmake:238 (COULD_NOT_FIND_BOOST)

CMakeLists.txt:443 (INCLUDE)

Configuring incomplete, errors occurred!

See also "/ root/mysql-5.7.11/CMakeFiles/CMakeOutput.log".

Add the boost option again as required, and cmake again:

[root@zhangMySQL5711 mysql-5.7.11] # cmake\

>-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

>-DMYSQL_DATADIR=/mysql/data\

>-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\

>-DDEFAULT_CHARSET=utf8\

>-DDEFAULT_COLLATION=utf8_general_ci\

>-DEXTRA_CHARSETS=all\

>-DENABLED_LOCAL_INFILE=1\

>-DDOWNLOAD_BOOST=1\

>-DWITH_BOOST=/usr/local/boost

-- Running cmake version 2.8.12.2

-- Could NOT find Git (missing: GIT_EXECUTABLE)

-- Configuring with MAX_INDEXES = 64U

-- SIZEOF_VOIDP 8

-- MySQL 5.7.11

-- Packaging as: mysql-5.7.11-Linux-x86_64

-- Downloading boost_1_59_0.tar.gz to / usr/local/boost

-- [download 0 complete]

-- [download 1% complete]

-- [download 2% complete]

-- [download 3% complete]

-- [download 4% complete]

-- [download 5% complete]

-- [download 6% complete]

-- [download 7% complete]

-- Download failed, error: 28; "Timeout was reached" / / I really can't stand the speed of the snail. Maybe 30Kb/s failed to download.

CMake Error at cmake/boost.cmake:187 (MESSAGE):

You can try downloading

Http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz / / it is recommended to copy the link, directly on the browser, or download it on Xunlei, which is super fast.

Manually using curl/wget or a similar tool, or increase the value of

DOWNLOAD_BOOST_TIMEOUT (which is now 600seconds)

Call Stack (most recent call first):

CMakeLists.txt:443 (INCLUDE)

Download the boost file

[root@zhangMySQL5711 boost] # pwd / / directory should be consistent with the definition of cmake

/ usr/local/boost

[root@zhangMySQL5711 boost] # ll

Total 81760

Drwx- 8 zabbix 20 4096 Aug 12 2015 boost_1_59_0

-rw-r--r-- 1 root root 83709983 Feb 24 16:42 boost_1_59_0.tar.gz / / download it. Decompress it.

Redefine cmake

Cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DMYSQL_DATADIR=/mysql/data\

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DEXTRA_CHARSETS=all\

-DENABLED_LOCAL_INFILE=1\

-DDOWNLOAD_BOOST=1\

-DWITH_BOOST=/usr/local/boost/boost_1_59_0

[root@zhangMySQL5711 mysql-5.7.11] # cmake\

>-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

>-DMYSQL_DATADIR=/mysql/data\

>-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\

>-DDEFAULT_CHARSET=utf8\

>-DDEFAULT_COLLATION=utf8_general_ci\

>-DEXTRA_CHARSETS=all\

>-DENABLED_LOCAL_INFILE=1\

>-DDOWNLOAD_BOOST=1\

>-DWITH_BOOST=/usr/local/boost/boost_1_59_0

-- 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.4.7

-- The CXX compiler identification is GNU 4.4.7

-- 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

. / / too much space, intercept the beginning and end

-- Performing Test HAVE_NO_UNUSED_TYPEDEFS-Success

-- Library mysqlserver depends on OSLIBS-lpthread;m;rt;crypt;dl;aio

-- INSTALL mysqlclient.pc lib/pkgconfig

-- CMAKE_BUILD_TYPE: RelWithDebInfo

-- COMPILE_DEFINITIONS: _ GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H

-- 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_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: / root/mysql-5.7.11

Cmake is finished here, and it goes smoothly.

5. Make operation

[root@zhangMySQL5711 mysql-5.7.11] # make / / the long process mainly depends on the configuration of the machine. My virtual machine was given 1300m, so it took about 25 minutes.

Scanning dependencies of target INFO_BIN

[0%] Built target INFO_BIN

Scanning dependencies of target INFO_SRC

[0%] Built target INFO_SRC

Scanning dependencies of target abi_check

[0%] Built target abi_check

Scanning dependencies of target zlib

[0%] Building C object zlib/CMakeFiles/zlib.dir/adler32.c.o

[0%] Building C object zlib/CMakeFiles/zlib.dir/compress.c.o

[0%] Building C object zlib/CMakeFiles/zlib.dir/crc32.c.o

[0%] Building C object zlib/CMakeFiles/zlib.dir/deflate.c.o

[0%] Building C object zlib/CMakeFiles/zlib.dir/gzio.c.o

. . .

Linking CXX executable mysql_embedded

[100%] Built target mysql_embedded

Scanning dependencies of target mysqltest_embedded

[100%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o

Linking CXX executable mysqltest_embedded

[100%] Built target mysqltest_embedded

Scanning dependencies of target my_safe_process

[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o

Linking CXX executable my_safe_process

[100%] Built target my_safe_process

[root@zhangMySQL5711 mysql-5.7.11] #

Note:

The compiled file package of version 5.6.19 of mysql is about 2G / / the author has been using version 5.6.19 or above.

MySQL5.7.11 compilation and installation also require a lot more disks than previous versions, and the mysql-5.7.11 folder after make is about 4.8G.

Before you start compilation:

[root@zhangMySQL5711 boost] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/VolGroup-lv_root

11G 4.3G 5.3G 45% /

Tmpfs 634M 0634M 0% / dev/shm

/ dev/sda1 477M 112M 340M 25% / boot

After the compilation is complete:

[root@zhangMySQL5711] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/VolGroup-lv_root

11G 9.1G 427m 96% /

Tmpfs 634M 0634M 0% / dev/shm

/ dev/sda1 477M 112M 340M 25% / boot

/ dev/sdb1 5.8G 12m 5.5G 1% / mysql

At this time, if the implementation of make install will be due to insufficient disk, resulting in missing important files, the author, tried several times, all failed. The final error is as follows:

-- Installing: / usr/local/mysql/bin/mysql_embedded

CMake Error at libmysqld/examples/cmake_install.cmake:42 (FILE):

File INSTALL cannot copy file

"/ root/mysql-5.7.11/libmysqld/examples/mysql_embedded" to

"/ usr/local/mysql/bin/mysql_embedded"

Call Stack (most recent call first):

Cmake_install.cmake:116 (INCLUDE)

Make: * * [install] Error 1

[root@zhangMySQL5711 mysql-5.7.11] #

And the installation file of 5.7.11 is also slightly larger than before.

5.6.19-> 1.1g

5.7.11-> 1.9g

Therefore, it is suggested that we should try to give more space.

6. Make install installation:

[root@zhangMySQL5711 mysql-5.7.11] # make install

.

-- Installing: / usr/local/mysql/mysql-test/./lib/mtr_misc.pl

-- Up-to-date: / usr/local/mysql/mysql-test/mtr

-- Up-to-date: / usr/local/mysql/mysql-test/mysql-test-run

-- Installing: / usr/local/mysql/mysql-test/lib/My/SafeProcess/my_safe_process

-- Up-to-date: / usr/local/mysql/mysql-test/lib/My/SafeProcess/my_safe_process

-- Installing: / usr/local/mysql/mysql-test/lib/My/SafeProcess/Base.pm

-- Installing: / usr/local/mysql/support-files/my-default.cnf

-- Installing: / usr/local/mysql/support-files/mysqld_multi.server

-- Installing: / usr/local/mysql/support-files/mysql-log-rotate

-- Installing: / usr/local/mysql/support-files/magic

-- Installing: / usr/local/mysql/share/aclocal/mysql.m4

-- Installing: / usr/local/mysql/support-files/mysql.server

[root@zhangMySQL5711 mysql-5.7.11] #

7. Initialize MySQL

[root@zhangMySQL5711 bin] # / mysqld-- initialize-- user=mysql-- datadir=/mysql/data-- basedir=/usr/local/mysql-- socket=/tmp/mysql.sock / / it was bin/mysql_install_db-- user before MySQL version 5.7.6

2016-02-25T04:36:27.941245Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2016-02-25T04:36:29.363359Z 0 [Warning] InnoDB: New log files created, LSN=45790

2016-02-25T04:36:29.529261Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-02-25T04:36:29.615486Z 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: 56a9ad19-db79-11e5-bc10-080027207e2e.

2016-02-25T04:36:29.635578Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2016-02-25T04:36:29.645190Z 1 [Note] A temporary password is generated for root@localhost: oej

twelve。 Modify root password

Mysql > set password=password ('zhangmysql')

Query OK, 0 rows affected, 1 warning (0.00 sec) / / View warning prompt

Mysql > show warnings

+- -- +

| | Level | Code | Message / / below indicates that this method will be abandoned in the future |

+- -- +

| Warning | 1287 | 'SET PASSWORD = PASSWORD ('')'is deprecated and will be removed in a future release. Please use SET PASSWORD =''instead |

+- -- +

1 row in set (0.00 sec)

Thank you for reading! This is the end of this article on "how to compile and install the latest MySQL 5.7.11 for CentOS6.5". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report