mysql5.7.11 Source compilation installation (Red hat Linux 6.5)

Source: Internet
Author: User

mysql5.7.11 Source compilation installation (Red hat Linux 6.5)
First, the preparatory work
1.1 Uninstalling the system comes with MySQL

Check to see if the system comes with MySQL, uninstall it if any, there are two kinds of yum, RPM, here to uninstall via Yum

Rpm-qa | grep mysql//view system comes with MySQL
Yum-y Remove mysql-*//uninstall MySQL
Rpm-e–nodeps mysql-5.1.73-3.el6_5.x86_64//uninstall MySQL
1.2 Uninstalling the system comes with boost and installs Boost_1_59_0

MySQL 5.7 relies on boost_1_59_0 or later to see if the system is self-contained, and if so, uninstalls it.

Rpm-qa | grep boost//View system comes with boost
Yum-y Remove boost-*//Offload boost
Rpm-e–nodeps boost-filesystem-1.41.0-11.el6_1.2.x86_64//Offload boost

Install BOOST_1_59_0, CMake compile-time plus-dwith_boost=/usr/local/boost

TAR-ZXVF boost_1_59_0.tar.gz
MV Boost_1_59_0/usr/local/boost

1.3 Installing dependent Packages

Yum install gcc gcc-c++ ncurses ncurses-devel Bison libgcrypt Perl

1.4 Installing CMake

TAR-ZXVF cmake-3.4.1.tar.gz
./configure
Make && make install
1.5 download MySQL source package mysql-5.7.11.tar.gz

Download via wget

wget http://cdn.mysql.com/Downloads/MySQL-5.7.11/mysql-5.7.11.tar.gz

Download the required source package in Windows and upload it via the File Transfer tool Rzsz

Yum Install Lrzsz//installation Rzsz
RZ//Upload

1.6 Creating user groups MySQL and user MySQL

Check if the system already has a MySQL user and if not, create

Cat/etc/group | grep MySQL//See if there is a MySQL user group
cat/etc/passwd | grep MySQL//See if a MySQL user exists
Groupadd MySQL//create user groups
Useradd-r-G MySQL MySQL//create user

1.7 Create MySQL directory and database directory, and give users MySQL permissions

Create MySQL directory and database directory

Mkdir/usr/local/mysql//Create MySQL Directory
Mkdir/usr/local/mysql/data//Create a database directory
Chown-r mysql:mysql/usr/local/mysql//give permission
Second, compile, install, configure MySQL
2.1 Compiling, installing MySQL

Compile with some parameters such as installation root, database directory, encoding, port number, default storage engine, etc.
When compiling, remember to bring-dwith_boost=/usr/local/boost.

TAR-ZXVF mysql-5.7.11.tar.gz
CD mysql-5.7.11
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-ddefault_charset=utf8-ddefault_ Collation=utf8_general_ci-dmysql_tcp_port=3306-dmysql_user=mysql-dwith_myisam_storage_engine=1-dwith_innobase_ Storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_memory_storage_engine=1 -denable_downloads=1-ddownload_boost=1-dwith_boost=/usr/local/boost
Make && make install
Configuration options reference Address, [http://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html][1]
2.2 compilation error, before recompiling to delete the compilation failed file

When recompiling, you need to clear the old object file and cache information

Make clean
Rm-f CMakeCache.txt

2.3 Configuring MY.CNF

MY.CNF files can be based on their own needs to choose the right configuration, there are many online, you can refer to, here is not detailed description. Remember to put the MY.CNF in/etc directory

MV MY.CNF/ETC/MY.CNF

2.4 Initializing the system data sheet

Starting with mysql5.7, initializing the system table no longer uses the mysql_install_db tool, but instead uses Mysqld–initialize-insecure–user=mysql, where –initialize indicates that a secure password is generated by default. –initialize-insecure means no password is generated and the password is empty

Cd/usr/local/mysql
Bin/mysqld–initialize-insecure–user=mysql–basedir=/usr/local/mysql–datadir=/usr/local/mysql/data

2.5 Adding environment variables, registering as System services

Add an environment variable and add parameters to PATH:/usr/local/mysql/bin:/usr/local/mysql/lib

Vim/root/.bash_profile
Path=< Span>p a t h : Home/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
Source/root/.bash_profile

Registering as a system service

CP Support-files/mysql.server/etc/init.d/mysqld
Chkconfig mysqld on
Service Mysqld Start/stop/restart/status

First Login setting password

Mysqladmin-uroot-p password 123456//Login time
SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' 123456 '); After login
View process

NETSTAT-LNTP | grep 3306
Pkill mysqld


This article from the "Struggle for the Dream" blog, reprint please contact the author!

mysql5.7.11 Source compilation installation (Red hat Linux 6.5)

Related Article

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.