centos6.5-source code compile and install the latest MySQL5.7.10

Source: Internet
Author: User

After installing MySQL using Yum, this article describes the installation of the MYSQL5.7.10 service on the CentOS6.5 64-bit virtual machine by compiling the source code.


Environment:

os:centos6.5 x86_64 Minimized installation
cpu:1
mem:1g

Note: The above cpu/mem parameter is too small, compile time will be very long, very long ...


1. Preparing to build and install dependent environments

shell> Yum install gcc gcc-c++ cmake ncurses ncurses-devel-y
# 5.7.5, rely on boost tool, GEO support
shell> wget # Decompression, selectable Installed or not, if you do not install, you need to add a parameter to build the Boost directory when you compile MySQL
# We don't install it here, unzip it directly to./boost_1_59_0
shell> tar zxf boost_1_59_0.tar.gz


2. Create a MySQL user

shell> groupadd MySQL
shell> useradd-r-G mysql-s/bin/false MySQL


3. Download the source installation package and unzip it

shell> wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz
shell> tar zxf Mysql-5.7.10.tar.gz


4. Compiling the installation

# The following parameters are described in the MySQL official documentation, if not clear please visit

shell> cd mysql-5.7.10 Shell> cmake . -dcmake_install_prefix=/usr/local/mysql         -DMYSQL_DATADIR=/data/mysql         -ddownload_boost=1        -dwith_boost=. /boost_1_59_0        -dsysconfdir=/etc         -ddefault_charset=utf8mb4        -ddefault_collation =utf8mb4_unicode_ci shell> make #  If you assign a multi-core CPU to a virtual machine, you can add the J parameter to enable multi-core compilation; it's time-consuming shell> make  install shell> cd /usr/local/mysql # mysql base directory permission settings shell> chown -r
 mysql .

shell> chgrp -r mysql . #  initialization:  --initialize means a random root password is generated,--initialize-insecure means no root password is generated shell> bin/mysqld -- Initialize-insecure --user=mysql --basedir=/usr/local/mysql&nbsP;--datadir=/data/mysql shell> chown -r root . Shell> chown -r mysql /data/mysql


5. After the compilation and installation is complete, start the service

Shell> Bin/mysqld_safe--user=mysql & # To get here, in general you can succeed


6. Using the MySQL service management file mysql.server configure MySQL for system service

Shell> support-files/mysql.server Stop
shell> CP support-files/mysql.server/etc/init.d/mysqld
Shell > chmod +x/etc/init.d/mysqld
shell> chkconfig--add mysqld
shell> chkconfig--level 345 on
shell& Gt Chkconfig--list
shell> ln-s/etc/rc.d/init.d/mysqld/etc/init.d/mysqld
# Try to start the
shell> service Mysqld start # starts #
# output
starting MySQL. Success!
shell> Service mysqld Status # View running status #
# output
success! MySQL running (1303)
shell> service mysqld Stop # Stop Services
# # Output
shutting down MySQL: success!

At this point, the source code compiled to install the latest version of MySQL service completed


7. Other

For official documentation please see:

Http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html

Http://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html




This article is from the "Years Phonograph" blog, please be sure to keep this source http://fyduan.blog.51cto.com/4234935/1729873

centos6.5-source code compile and install the latest MySQL5.7.10

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.