LNMP Environment Installation (3)-mysql source code compilation and installation

Source: Internet
Author: User

I. Overview

MySQL is a cross-platform open source relational database management system, currently affiliated with Oracle Corporation. MySQL is widely used in small and medium-sized websites on the internet. Because of its small size, fast speed, low total cost of ownership, especially the open source, many small and medium-sized web sites in order to reduce the total cost of ownership of the site chose MySQL as the site database.

This section uses mysql-5.6.16 's source code for MySQL installation.

MySQL's source level installation is based on a tool cmake. CMake is a cross-platform installation ( compilation ) tool that can be used to describe the installation of all platforms (the compilation process) with simple statements

The following installations are performed based on the CentOS system

Second, the source code download

http://dev.mysql.com/downloads/

Select MySQL Community server on this page to download, but because the MySQL official website part JS uses the Google CDN, cannot choose the system to switch, needs to turn over the wall only then can carry on the normal download!

You can also use the Baidu Cloud disk resources I provide to download

Link: Http://pan.baidu.com/s/1dD6QZ1B Password: zcs8

Third, installation

1. Dependent Packages

#yum install-y ncurses-devel//ncurses provides a library of character terminal processing, including panels and menus.

1, installation CMake

# yum Install-y cmake

Install software under Linux the journey uses./configure and make, what are the similarities for CMake?

CMake. <=>./configure

CMake. -lh or Ccmake. <=>./configure--help

2. Adding database Users and Groups

Create a data store directory

# MKDIR/DATA/MYDATA-PV//This directory can be placed above the LVM virtual disk partition

# groupadd-r MySQL

# useradd-g Mysql-r-d/data/mydata MySQL

3. mysql installation configuration

Options that are commonly used when specifying the installation path for installation files

-dcmake_install_prefix=path Specifying the installation path

-dmysql_datadir=path specifying the data storage path

-dsysconfdir=path specifying the configuration file path

The storage engine is compiled by default: CSV, MyISAM, MYISAMMRG, head, InnoDB. To install additional storage engines, the following options

-dwith_innobase_storage_engine=1 Enable InnoDB storage engine

-dwith_archive_storage_engine=1 Enable ARCHIVE storage engine

-dwith_blackhole_storage_engine=1 Enable Blackhole black hole storage Engine

-dwith_fedreated_storage_engine=1 enable fedreated storage engine

Do not use a storage engine

-dwithout_example_storage_engine=1

-dwithout_fedreated_storage_engine=1

-dwithout_parition_storage_engine=1

Other features use or do not use

-dwith_editline=1

-dwith_ssl=system

-dwith_zlib=system

-dwith_libwrap=0

Other common options

-dmysql_tcp_port=3306 Port number

-dmysql_unix_addr=/tmp/mysql.sock Local communication sockets

-ddefault_charset=utf8 Setting the default character encoding

-ddefault_collation=utf8_general_ci Setting the default collation

-dwith_debug=0 setting whether to turn on debugging

Use the following command to configure MySQL installation

# CD mysql-5.6.16/

# CMake. -DCMAKE_INSTALL_PREFIX=/USR/LOCAL/MYSQL-DMYSQL_DATADIR=/DATA/MYDATA-DSYSCONFDIR=/ETC \

-dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1 \

-dwith_ssl=system-dwith_zlib=system-dwith_libwrap=0-dmysql_unix_addr=/tmp/mysql.sock

4. Compile and install

# make

# make Install

5. Database initialization

# scripts/mysql_install_db--user=mysql--datadir=/data/mydata

# Chown-r Mysql:mysql/data/mydata

# Cd/usr/local/mysql

# Chown-r Mysql:root.

6. mysql configuration file

# CD mysql-5.6.16/

# CP SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF

7. Add sysv service script for MySQL

# Cd/usr/local/mysql

# CP Support-files/mysql.server/etc/rc.d/init.d/mysqld

# chmod +x/etc/rc.d/init.d/mysqld

Add to Service list

# chkconfig--add mysqld

# Chkconfig Mysqld on

8. Start the service

# service Mysqld Start

9. Test Connection Database

Data commands Add environment variables

# vim/etc/profile.d/mysql.sh

Create the following content:

Export path= $PATH:/usr/local/mysql

# chmod +x/etc/profile.d/mysql.sh

# souce/etc/profile.d/mysql.sh//Do not restart the Computer manual update modify environment variables

# Mysql-uroot//Test Connection database

10. Modify the Database password

Enter the Mysqlshell interface

Three ways to change the password, here is a kind of set PASSWORD

mysql> Set password for [email protected] = password (' root ');


Integration above, you can complete the MySQL database source-level installation


LNMP Environment Installation (3)-mysql source code compilation and installation

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.