mysql5.7 Compiling and installing

Source: Internet
Author: User

MySQL5.7.17 compilation and installation and binary installation detailed

Posted in 2017/3/5 23:25:35 1539 People reading

Category: MySQL Linux

There are many ways to install MySQL, the most common is the compilation and installation and binary installation;

Here I will introduce two kinds of installation methods, free choice;

First, let's take a look at the steps to compile the installation:

First, to the official website to download the source package;

Https://dev.mysql.com/downloads/mysql

Select Download Source Package:



There are many source packages for different systems, we choose the Universal version:



When the download is complete, put it on our server;

Next follow the steps to decompress the installation can be compiled;

MySQL starts from 5.5 and compiles the settings using CMake, so we'll also install the CMake compilation tool:


Shell > Yum-y Install CMake


According to official documentation, this process consumes more memory, and it is important to note that starting with the MySQL5.7 version, installing MySQL requires a Boost of C + + extensions and can only be 1.59.0 version;

boost:http://www.boost.org/users/history; Select 1.59.0 version Download, in the compilation is to fill in the corresponding parameters, specify the boost source location can be;


Shell > Tar zxf boost_1_59_0.tar.gz #解压扩展

Shell > MV Boost_1_59_0/usr/local/boost # Cut the extension source to/usr/local

Shell > Groupadd mysql

Shell > Useradd-r-G mysql-s/bin/false MySQL # Create a non-logged on user


Create the installation directory and data store directory, and Modify permissions


Shell > Mkdir-p/usr/local/mysql/data

Shell > Chown-r mysql:mysql/usr/local/mysql

Shell > Tar zxf mysql-5.7.17.tar.gz #解压mysql源码包

Shell > CD mysql-5.7.17 #切换目录到刚解压的文件夹中

Shell > cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-dmysql_unix_addr=/ Tmp/mysql.sock-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dwith_boost=/usr/local/boost


CMake parameter Explanation:

-dcmake_install_prefix: Specifying the installation path

-dmysql_datadir: Specifying the data storage path

-DMYSQL_UNIX_ADDR: Specify the path to the suite Word

-ddefault_charset: Setting the character set

-ddefault_collation: Set character check set

-dwith_boost: Specify the BOOST extension source path


Shell > Make #此过程很漫长, wait patiently

Shell > Make Install

Shell > Chown-r Mysql:mysql/usr/local/mysql # re-Modify permissions

Shell > Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf #复制配置文件

Shell > Vim/etc/my.cnf # Modify the configuration file to modify the contents as follows

Basedir =/usr/local/mysql/

DataDir =/usr/local/mysql/data

Socket =/tmp/mysql.sock

Shell > Cd/usr/local/mysql #切换至安装目录

Shell > Bin/mysqld--defaults-file=/etc/my.cnf--initialize--user=mysql # Initialize Database


Command parameter explanation:

--defaults-file: Developing a MySQL profile path

--initialize: Initialize the random password, note that the initialized password is an expired password, after login need to change the password

--user: Specify account

After the last command is executed, a random password is given at the end of the command prompt.

Be sure to remember to record this password


Shell > Support-files/mysql.server start #启动mysql Server

Shell > Bin/mysql-u root-p

Enter Password: # Enter just the random password link database

Mysql> ALTER USER ' root ' @ ' localhost ' identified by ' new password ';


At this point: mysql5.7+ compiled installation completed;



========================



OK, next we are doing, binary installation,

Binary installation of the way is relatively simple, in fact, the steps are similar, but the official help us to compile, do not need us in the use of CMake, make, made install and other commands to compile;

We only need to download the decompression, and then do the corresponding operation configuration can be;

However, we need to download a larger binary package file;

Https://dev.mysql.com/downloads/mysql






After downloading, we make the relevant configuration, the previous steps are almost the same as when compiling the installation, you also need to add users and groups, if you have already added, you do not need to repeat the operation, skip directly:


Shell > Groupadd mysql

Shell > Useradd-r-G mysql-s/bin/false MySQL # Create a non-logged on user


Binary installation requires Libaio extensions:


Shell > Yum-y Install Libaio libaio-devel

Shell > Tar zxf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

Shell > MV Mysql-5.7.17-linux-glibc2.5-x86_64/usr/local/mysql # Cut the source package to the appropriate directory

Shell > Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf #复制配置文件

Shell > Vim/etc/my.cnf # Modify the configuration file to modify the contents as follows


Basedir =/usr/local/mysql/

DataDir =/usr/local/mysql/data

Socket =/tmp/mysql.sock


Shell > Cd/usr/local/mysql #切换至目录

Shell > Cd/usr/local/mysql #切换至安装目录

Shell > Bin/mysqld--defaults-file=/etc/my.cnf--initialize--user=mysql # Initialize Database


Command parameter explanation:

--defaults-file: Developing a MySQL profile path

--initialize: Initialize the random password, note that the initialized password is an expired password, after login need to change the password

--user: Specify account

After the last command is executed, a random password is given at the end of the command prompt.

Be sure to remember to record this password


Shell > Support-files/mysql.server start #启动mysql Server

Shell > Bin/mysql-u root-p

Enter Password: # Enter just the random password link database

Mysql> ALTER USER ' root ' @ ' localhost ' identified by ' new password ';


At this point the binary installation is complete!!!

Compilation and installation with the binary installation process and the principle of almost identical, the biggest difference is that we need to download the compilation of the source code for manual compilation, and the binary installation does not require us to manually compile;

mysql5.7 Compiling and installing

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.