CentOS 6.6 Under source code compilation install MySQL 5.7.5

Source: Internet
Author: User

Copyright notice: Transfer from:http://www.linuxidc.com/Linux/2015-08/121667.htm

Description:CentOS 6.6 Under source code compilation install MySQL 5.7.5

1. Installing related tools
# yum-y Install gcc-c++ ncurses-devel cmake make perl \
GCC autoconf automake zlib libxml libgcrypt libtool Bison
2. Clean up the environment
Check the Boost version:

# Rpm-qa boost*
Uninstall boost-* and other libraries:

# yum-y Remove boost-*
3. mysql Source package download
mysql5.7 Source Download:
Http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.5-m15.tar.gz
MySQL Mirror station:
http://mirrors.sohu.com/mysql/

4. Create MySQL user, group and directory
# Groupadd MySQL
# Mkdir/home/mysql
# Mkdir/home/mysql/data
# useradd-g mysql-d/home/mysql
5. Precautions
Starting the boost library from MySQL 5.7.5 is required, download the Boost library, copy it to the/usr/local/boost directory after decompression, and then cmake and add options to the following options-dwith_boost=/usr/local/boost
(Download: http://sourceforge.net/projects/boost/files/boost/)

Demand boost1.57.0

Wget-c http://liquidtelecom.dl.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.tar.gz
6. The new version of MYSQ is installed with the CMake compiler
Extract MySQL source package mysql-5.7.5-m15.tar.gz

# TAR-XZVF Mysql-5.7.5-m15.tar.gz
The following operations are performed in the root directory of the extracted source package

CMake compiling

# Cmake-dcmake_install_prefix=/home/mysql-dmysql_datadir=/home/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 -ddownload_boost=1-dwith_boost=/usr/local/boost
Common parameters:

Cmake_install_prefix: Specifies the installation directory of the MySQL program, default/usr/local/mysql
Default_charset: Specifies the server default character set, default Latin1
Default_collation: Specifies the default proofing rules for the server, default Latin1_general_ci
Enabled_local_infile: Specifies whether to allow load DATA INFILE to be executed locally, by default off
With_comment: Specifying compilation Notes Information
With_xxx_storage_engine: Specifies a storage engine that is statically compiled to MySQL, and the Myisam,merge,member and CSV four engines are compiled to the server by default and do not require special designation.
Without_xxx_storage_engine: Specifying a storage engine that does not compile
Sysconfdir: Initialize parameter file directory
Mysql_datadir: Data Files directory
Mysql_tcp_port: Service port number, default 3306
Mysql_unix_addr:socket file path, default/tmp/mysql.sock
Compiling the installation

# Make && make install
Rerun configuration after error, need to delete CMakeCache.txt file

# Make Clean
# rm-f CMakeCache.txt
7. Set permissions and initialize MySQL system authorization form
Set permissions

# Cd/home/mysql
# chown-r MySQL.
# chgrp-r MySQL.
To initialize the operation with root to add the –user=mysql parameter, generate a random password (note to save login)

# Cd/home/mysql
# bin/mysqld--initialize--user=mysql--basedir=/home/mysql--datadir=/home/mysql/data
8. Create a configuration file
MY.CNF backup that will be generated by default

# Mv/etc/my.cnf/etc/my.cnf.bak
Access to MySQL installation directory support file directory

# Cd/home/mysql/support-files
Copy the profile template to the new MySQL configuration file,

# CP MY-DEFAULT.CNF/ETC/MY.CNF
You can modify the new profile options as needed, without modifying the configuration options, and MySQL runs on the default configuration parameters.
as follows, I modify the configuration file/etc/my.cnf, which is used to set the encoding to UTF8 to prevent garbled

[Mysqld]

Character_set_server=utf8
init_connect= ' SET NAMES UTF8 '

[Client]
Default-character-set=utf8
9. Configure the MySQL service to boot automatically
Copy boot file to/etc/init.d/and command to Mysqld

# Cp/home/mysql/support-files/mysql.server/etc/init.d/mysql
Increase execution permissions

# chmod 755/etc/init.d/mysqld
Check the list of self-initiated items without mysqld this, and if not, add Mysqld:

# chkconfig--list mysqld
# chkconfig--add mysqld
Set MySQL to automatically start at 345 level

# chkconfig--level 345 mysqld on
Or use this command to set the boot up:

# Chkconfig Mysqld on
Startup/restart/stop of MySQL service
Start the MySQL service

# service Mysqld Start
Restart MySQL Service

# Service Mysqld Restart
Stop MySQL Service

# Service Mysqld Stop
11. Accessing the MySQL Database
Connect MySQL, enter the random password generated by the initialization

# mysql-uroot-p
Change root new password such as 123456

mysql> alter user ' root ' @ ' localhost ' identified by ' 123456 ';
Mysql> quit;
Mysql> exit; (with the best effect, it is the MySQL connection)
Reconnect MySQL with the new password

# mysql-uroot-p

here is a small series of carefully selected MySQL-related content to see if it helps :

Linux Installation compiled MySQL5.5.28 http://www.linuxidc.com/Linux/2015-08/121533.htm

Linux under MySQL 5.6.23 installation http://www.linuxidc.com/Linux/2015-07/119934.htm

CentOS 7 under source installation MySQL 5.6 http://www.linuxidc.com/Linux/2015-06/119354.htm

MySQL5.7.3.0 Installation Configuration Illustration tutorial Http://www.linuxidc.com/Linux/2014-10/108397.htm

Install MySQL http://www.linuxidc.com/Linux/2014-05/102366.htm under Ubuntu 14.04

"MySQL authoritative guide (original book 2nd edition)" Clear Chinese scanning version PDF http://www.linuxidc.com/Linux/2014-03/98821.htm

Ubuntu 14.04 LTS installation lnmp nginx\php5 (PHP-FPM) \mysql http://www.linuxidc.com/Linux/2014-05/102351.htm

Build MySQL master server http://www.linuxidc.com/Linux/2014-05/101599.htm under Ubuntu 14.04

Ubuntu 12.04 LTS builds a highly available distributed MySQL cluster http://www.linuxidc.com/Linux/2013-11/93019.htm

Ubuntu 12.04 under source code installation MySQL5.6 and Python-mysqldb http://www.linuxidc.com/Linux/2013-08/89270.htm

MySQL-5.5.38 Universal Binary Installation http://www.linuxidc.com/Linux/2014-07/104509.htm

For more information on CentOS, see the CentOS feature page http://www.linuxidc.com/topicnews.aspx?tid=14

This article permanently updates the link address : http://www.linuxidc.com/Linux/2015-08/121667.htm

CentOS 6.6 Under source code compilation install MySQL 5.7.5

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.