Linux under MySQL source installation full version

Source: Internet
Author: User
Tags openssl

Install MySQL in Linux, usually in RPM and source mode. For production environments, it is necessary to install multiple sources of code, such as installation paths, data file locations, character sets, and supported storage engines. Previously wrote an article about the source installation, Linux under the source-based approach to install MySQL 5.6, but not very complete, so this article can be supplemented. The following are the specific installation steps for your reference.

1, before the installation of the relevant description
Essential Packages and tools
gcc/g++: MySQL 5.6 starts and needs to be compiled with g++.
Starting with Cmake:mysql 5.5, CMake is used for project management, and CMake requires more than 2.8 versions.
The BISON:MYSQL syntax parser needs to be compiled with bison.
Ncurses-devel: A development package for terminal operations.
Zlib:mysql using zlib for compression

Package Required for function
Libxml: Support for XML input and output methods.
OpenSSL: Use the OpenSSL Secure Sockets method to communicate.
DTrace: Used to diagnose MySQL problems.

About MySQL compilation parameters
Cmake_build_type compiled version type: Relwithdebinfo and debug, the difference is that Relwithdebinfo will be optimized.
CMAKE_INSTALL_PREFIX Specifies the destination path for the make install installation.
SYSCONFDIR Specifies the default path for the configuration file.
MYSQL_DATADIR Specifies the default path for the data directory.
WITH_DEBUG Specifies whether there is debugging information, commonly used for source debugging, open with_debug, production environment shutdown.
enabled_profiling Specifies whether the show profile can be used to display the details of the operation execution.
DEFAULT_CHARSET Specifies the default character set, which can be specified in the startup configuration file.
default_collation Specifies the default character comparison, sorting rules.
WITH_EXTRA_CHARSETS specifies the other possible character sets that may be used.
WITH_SSL Specifies the type of SSL, starting with the default bundled type from 5.6.6, and optionally specifying the path address of the SSL library.
WITH_ZLIB Specifies the type of ZLIB to use for compression functions.
ENABLED_LOCAL_INFILE Specifies whether the load data INFILE feature is allowed.
WITH_EMBEDDED_SERVER Specifies whether to compile the Libmysqld embedded library.
INSTALL_LAYOUT Specifies the type of layout to install.
WITH_STORAGE_STORAGE_ENGINE Specifies the storage engine supported by the compilation, and the Myisam,merge,memory,csv storage engine is supported by default.
For more detailed parameters, refer tohttp://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html

This installation environment
[Email protected] ~]# cat/etc/issue
CentOS release 5.9 (Final)
Kernel \ r on an \m

[Email protected] ~]# uname-a
Linux sz-rd03 2.6.18-348.el5 #1 SMP Tue Jan 8 17:53:53 EST x86_64 x86_64 x86_64 gnu/linux

MySQL version: 5.6.12-log Source distribution
The installation directory is:/app/soft/mysql/
The Data directory is:/data/mysqldata
Storage engines include: MEMORY,MYISAM,INNODB, etc.
The character set is: UTF8

2, source installation MySQL
Install the libraries you need to use first:
Yum-y Install GCC gcc-c++
Yum-y Install Ncurses-devel

Download the required packages:
   #将下载的文件都放到/usr/local/src directory, as follows
   # cd/usr/local/src
  # wget http://www.cmake.org /files/v2.8/cmake-2.8.11.1.tar.gz
  # wget Span style= "Font-family:courier New;" >http://ftp.gnu.org/gnu/bison/bison-2.7.tar.gz
  # wget http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gz
  # wget http://www.mysql.com/get/downloads/mysql-5.6/ mysql-5.6.12.tar.gz/from/http://cdn.mysql.com/

Installing the CMake Compiler
# CD/USR/LOCAL/SRC
# TAR-XVF Cmake-2.8.11.1.tar.gz
# CD cmake-2.8.11.1
#./bootstrap
# Make && make install

Installing M4
# CD/USR/LOCAL/SRC
# TAR-XVF M4-1.4.16.tar.gz
# CD m4-1.4.16
#./configure && make && make install

Installing Bison
# CD/USR/LOCAL/SRC
# TAR-XVF Bison-2.7.tar.gz
# CD bison-2.7
#./configure && make && make install

Create MySQL users and groups, related directories
#/usr/sbin/groupadd MySQL
#/usr/sbin/useradd-g MySQL MySQL
# mkdir-p/app/soft/mysql
# Chown-r Mysql:mysql/app/soft/mysql
# mkdir-p/data/mysqldata
# Chown-r mysql:mysql/data/mysqldata/

Install MySQL
# CD/USR/LOCAL/SRC
# TAR-XVF Mysql-5.6.12.tar.gz
# export cflags= "-o3-g-fno-exceptions-static-libgcc-fno-omit-frame-pointer-fno-strict-aliasing"
# export cxxflags= "-o3-g-fno-exceptions-fno-rtti-static-libgcc-fno-omit-frame-pointer-fno-strict-aliasing"
# Export cxx=g++
# CD mysql-5.6.12
# cmake-dcmake_install_prefix=/app/soft/mysql/-dmysql_unix_addr=/tmp/mysql.sock
-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dwith_extra_charsets=utf8,gbk
-dwith_perfschema_storage_engine=1-dwith_federated_storage_engine=1-dwith_partition_storage_engine=1
-dwith_archive_storage_engine=1-dmysql_datadir=/data/mysqldata/-dsysconfdir=/app/soft/mysql/
-dwith_ssl=bundled-denabled_local_infile=1-dwith_innobase_storage_engine=1
-dwith_blackhole_storage_engine=1-denable_downloads=1
# Make && make install

Initializing the database
# cd/app/soft/mysql/
#./scripts/mysql_install_db--user=mysql--ldata=/data/mysqldata

3, after the installation of the finishing work
Configuring the Operating Environment
# Vi/etc/profile
# Path=/app/soft/mysql/bin:/app/soft/mysql/lib: $PATH
# Export PATH
# Source/etc/profile

Create a boot boot
# CP support-files/my-default.cnf/etc/my.cnf #也可以将my. CNF copied directly to the installation file location
# CP Support-files/mysql.server/etc/init.d/mysqld
# chkconfig--level mysqld on
# service Mysqld Start


Whether the search started successfully
NETSTAT-NTLP | grep MySQL

Set Root password
# mysqladmin-u root password ' xxx '

Login account
# mysql-uroot-pxxx

Configuration parameters
Configure MY.CNF files according to system and business requirements

Linux under MySQL source installation full version

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.