centos6.7 Compiling and installing mysql5.7.17

Source: Internet
Author: User
Tags create directory deprecated uuid

centos6.7 Compiling and installing mysql5.7.17

2017-03-24

09:57:15

Tips: mysql5.7.17 is not the same as the previous version 5.56 and needs to be cmake

In addition, look at this document's MySQL compilation before I say, the first time must probably read the whole process, can not always follow the document to do, or later prone to problems. For example, the compilation will occupy a special amount of disk space, in case there is not enough space allocated before, so the loss of many important files will lead to failure.

Pre-installation work:

1, download MySQL5.7.17 source package from official website

http://dev.MySQL.com/downloads/mysql/#downloads //Can be downloaded here. It is also possible to download a generic package, in this case a generic package and boost package

2, install the CentOS6.7 64-bit operating system.

3. Pre-install dependent packages: 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 an individual used in the installation of older versions, dependent packages

Environment: centos6.7

Two packages required:

Boost_1_59_0.tar.gz

Mysql-5.7.17.tar.gz

1. See if you have installed MySQL

[Email protected] ~]# Rpm-qa | grep MySQL

If it's installed, stop the MySQL service and uninstall it

[[Email protected] ~] #service mysqld Stop

If the RPM package is installed, uninstall it with RPM-E, if the Yum installation is uninstalled with yum-y remove. and delete the installation directory and so on

Install MySQL officially

2. Add MySQL User and owning group (to see if there is already MySQL users and Groups)

[[Email protected] ~] #cat/etc/passwd | grep MySQL//check to see if a MySQL user already exists

[[Email protected] ~] #cat/etc/group | grep MySQL//See if the MySQL group already exists

[[email protected] ~]# Groupadd MySQL//If first execute the following command will prompt without MySQL this group

[[email protected] ~]# useradd-r-g MySQL MySQL

3. Create MySQL installation directory and data directory

[[email protected] home]# mkdir mysql //Create directory as MySQL5.7.17 installation path

[[email protected] home]# mkdir data //Create directory as MySQL5.7.17 path

4. Modify MySQL Directory owner

[Email protected] support-files]# chown-r mysql:mysql/home/mysql

5. Unzip the source package

I have already put two packages in the/home directory (can use WINSCP, can also use the Linux RZ command, but need to install RZ related packages)

[Email protected] ~]# cd/home/

[[email protected] home]# ls // put these two packages in the/home directory and unzip

Boost_1_59_0 boost_1_59_0.tar.gz mysql-5.7.17 mysql-5.7.17.tar.gz

[[email protected] home] #tar-ZXVF mysql-5.7.11.tar.gz

[[email protected] home] #tar –ZXVF boost_1_59_0.tar.gz

[[Email protected] home]# CD mysql-5.7.17/ // Enter the MySQL directory after decompression is complete

[[email protected] mysql-5.7.17]# ls

BUILD Docs libmysqld README unittest

Client Doxyfile-perfschema libservices Regex VERSION

CMake Extra man Scripts vio

CMakeLists.txt include Mysql-test SQL win

Cmd-line-utils INSTALL Mysys Sql-common zlib

Config.h.cmake libbinlogevents Mysys_ssl Storage

Configure.cmake Libbinlogstandalone Packaging strings

COPYING libevent Plugin Support-files

Dbug Libmysql Rapid Testclients

Compile and install:

[Email protected] mysql-5.7.17]# cmake \

>-dcmake_install_prefix=/home/mysql \ Specify the installation path, if there is no MySQL this directory will be built in advance

>-dmysql_datadir=/home/data/\ Specify the data storage path, and if not, create a new

>-dmysql_unix_addr=/tmp/mysql.sock \ Specify the path of the suite Word

>-ddefault_charset=utf8 \ Set character sets

>-ddefault_collation=utf8_general_ci \ set character Check set

>-dextra_charsets=all \

>-denabled_local_infile=1 \

>-ddownload_boost=1 \//Download BOOST This package, before we downloaded, here can not use this parameter, because mysql5.7.17 need this package to compile, if the network is poor, download this is very slow , you might as well download it and put it in the Linux unzip

>-dwith_boost=/home/boost_1_59_0 Specifies the boost extension source path, where the path is the path that is obtained after the boost package is decompressed.

1. here to Make Installation:

[[email protected] mysql-5.7.17] #make// can make && do install

There are too many processes, and here is a copy of the final part of the command.

[100%] Building CXX Object LIBMYSQLD/EXAMPLES/CMAKEFILES/MYSQL_EMBEDDED.DIR/__/__/CLIENT/READLINE.CC.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

[[email protected] mysql-5.7.17]# echo $? Hint 0 shows that the compilation was successful.

0

Here to make the complete

2. Make Install Installation:

[[email protected] mysql-5.7.17]# make install

....... ... ////////// omitted from the above section

--Installing:/HOME/MYSQL/SUPPORT-FILES/MY-DEFAULT.CNF

--Installing:/home/mysql/support-files/mysqld_multi.server

--Installing:/home/mysql/support-files/mysql-log-rotate

--Installing:/home/mysql/support-files/magic

--Installing:/HOME/MYSQL/SHARE/ACLOCAL/MYSQL.M4

--Installing:/home/mysql/support-files/mysql.server

Confirm again, return 0 Note installation is successful no problem

[[email protected] mysql-5.7.17]# echo $?

0

3. Initialize MySQL

Switch to the installation directory:

[Email protected] mysql-5.7.17]# Cd/home/mysql/bin

Initialize the database:

[Email protected] bin]#/mysqld--initialize--user=mysql--datadir=/home/data/--basedir=/home/mysql--socket=/tmp/ Mysql.sock

2017-03-14t23:42:15.896642z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-03-14t23:42:17.753496z 0 [Warning] innodb:new log files created, lsn=45790

2017-03-14t23:42:18.037850z 0 [Warning] innodb:creating FOREIGN KEY constraint system tables.

2017-03-14t23:42:18.122664z 0 [Warning] No existing UUID have been found, so we assume that's the first time that thi s server has been started. Generating a new uuid:dc2d9f27-090f-11e7-8a26-000c29e5ba07.

2017-03-14t23:42:18.124749z 0 [Warning] Gtid table is not a ready-to-be used. Table ' mysql.gtid_executed ' cannot be opened.

2017-03-14t23:42:18.127431z 1 [Note] A temporary password is generated for [email protected]: iv5envxxdt,u

Before MySQL 5.7.6 version was bin/mysql_install_db--user

Note : MySQL5.7.17 version initialization will give the root user an initial password

In the end it's [email protected]: iv5envxxdt,u

There is another note: I personally encountered, initialized password, he randomly generated, the English letter O and the number 0 in Linux quite like. Sometimes the case is not clear. If we can copy the initial password to a. txt text in Linux, then copy one to Word in Windows and then enter the password to log in to the database

4. Add MySQL Service , copy MySQL configuration file

[email protected] bin]# cd/home/mysql// switch to the installation directory

[[email protected] mysql]# ls

Bin COPYING docs include Lib man mysql-test README share support-files

[Email protected] mysql]# CD support-files/

[[email protected] support-files]# ls

Magic my-default.cnf Mysqld_multi.server mysql-log-rotate mysql.server

[Email protected] support-files]# cp-a mysql.server/etc/init.d/mysql

-A can copy the original attributes together.

5. Edit my.cnf file

Add the following, here for brevity, save the rest, are in accordance with the default

[Email protected] support-files]# VIM/ETC/MY.CNF

[Mysqld]

port=3306

Basedir=/home/mysql

Datadir=/home/data

Socket=/tmp/mysql.sock

User=mysql

6. Restart MySQL , and set the Power on self-start

[[Email protected] support-files]# service MySQL start

Starting MySQL. success!

[[email protected] support-files] #chkconfig mysql on// set up start-up to develop a good habit

Note : Pro-Test mysql5.7.17 settings service startup is MySQL instead of mysqld, there is no wrong. This may be due to the version. I was compiled mysql5.7.17 from the beginning.

[email protected] support-files]# PS-EF// View is started

I like to use the service MySQL start, but before I saw others with/etc/init.d/mysql start this is also possible. (In fact, I am not very good at this study)

7. Login MySQL

[[Email protected] ~] #cd/home/mysql/bin

[email protected] bin]#./mysql-uroot–p// Tips: The database initial password is randomly generated and more complex. If it is built in Xshell, then you can copy the initial password and save it to a file. After copying, log in to the database, you can view the password file and enter the password. Or because you have previously copied the password, you can use the scroll wheel in the middle of the mouse to paste the password. Then log in to the database. Avoid error in initial password entry

Enter Password://I said before. MySQL5.7.17 version initialization will give the root user an initial password

In the end it's [email protected]ost:iv5envxxdt,u

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 3

Server version:5.7.17

Copyright (c), Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql>

8. Modify Root password (be sure to change your password after logging in, the initial password will expire once it is used once.) cannot be used for the second time)

mysql> SET PASSWORD = PASSWORD (' qwe12345 '); In fact, this lowercase is also possible, here is an example.

Query OK, 0 rows affected, 1 Warning (0.00 sec) Query OK, 0 rows affected, 1 Warning (0.00 sec)//Develop a good habit, he hints there are 1 warning which means there is a warning prompt. Let's take a look underneath.

mysql> Set Password=password (' 12345 '); In fact, lowercase is also possible

Mysql> Show warnings;

+---------+------+--------------------------------------------------------------------------------------------- ----------------------------------------------------------------------+

| Level | Code | Message // The following tip I will be abandoned after that method |

+---------+------+--------------------------------------------------------------------------------------------- ----------------------------------------------------------------------+

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

+---------+------+--------------------------------------------------------------------------------------------- ----------------------------------------------------------------------+

1 row in Set (0.00 sec)

Attention:

MySQL new setup user or change password after use flush privileges refresh the MySQL system permission related table, otherwise there will be denied access, another way is to restart the MySQL server, to make the new settings take effect

mysql> flush Privileges;

Mysql> quit;

At this point, the compilation installation is complete.

centos6.7 Compiling and installing mysql5.7.17

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.