Linux under source code compilation installation MySQL detailed

Source: Internet
Author: User

Linux under source code compilation installation MySQL detailed

1.REDHAT5 Environment, first install the compilation environment

Yum groupinstall-y "Development Libraries" "Development Tools"

2. Because the source code compiled MySQL requires CMake command, so first to compile and install the CMake package

First download the CMake package, download here to use cmake-2.8.8.tar.gz

Tar XF cmake-2.8.8.tar.gz

CD cmake-2.8.8

./configure

Make && make install

3. Compiling MySQL with CMake

CMAKE specifies compilation options in a different way from make, which is implemented in the following way:

./configure equivalent to CMake.

./configure--help equivalent to CMake. -lh or Ccmake.

4. Start the official compilation installation of MySQL, download here to use mysql-5.5.50.tar.gz

Groupadd-g 306 MySQL

Useradd-g 306-u 306-m-s/sbin/nologin MySQL

Mkdir-pv/mydata

Mount/dev/vg01/lv01/dev/mydata #新增一个LVM (omit) and mount it to/mydata

Mkdir-pv/mydata/data

Chown-r Mysql.mysql/mydata/data

Tar XF mysql-5.5.50.tar.gz

CD mysql-5.5.50

CMake. -dcmake_install_prefix=/usr/local/mysql \

>-dmysql_datadir=/mydata/data \ #mysql数据存放路径

>-DSYSCONFDIR=/ETC \

>-dwith_innobase_storage_engine=1 \

>-dwith_archive_storage_engine=1 \

>-dwith_blackhole_storage_engine=1 \

>-dwith_readline=1 \

>-dwith_ssl=system \

>-dwith_zlib=system \

>-dwith_libwrap=0 \

>-dmysql_unix_addr=/tmp/mysql.sock \

>-ddefault_charset=utf8 \

>-ddefault_collation=utf8_general_ci


Make

Make install

Install MySQL as in the general binary format below, if you are not familiar with it, see my previous blog

Chown-r. mysql/usr/local/mysql/#更改属组

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

CP SUPPORT-FILES/MY-HUGE.CNF/ETC/MY.CNF

CP Support-files/mysql.server/etc/init.d/mysqld #拷贝启动脚本

Chkconfig--add mysqld

Chkconfig mysqld on

Service mysqld Start

NETSTAT-ANTLP | grep 3306 #查看mysql启动状态

Ehco "/usr/local/mysql/bin" >>/etc/profile.d/mysql.sh #修改mysql环境变量

source/etc/profile.d/mysql.sh

MySQL #连接测试mysql

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/83/1B/wKioL1drSZGDPYt-AAEgLcnrK1s702.jpg-wh_500x0-wm_3 -wmp_4-s_1013295810.jpg "title=" 1.jpg "alt=" Wkiol1drszgdpyt-aaeglcnrk1s702.jpg-wh_50 "/>

5. Compile and install MySQL often with options explained


5.1. Specify the options that are commonly used when installing the installation path of a file:

-dcmake_install_prefix=/usr/local/mysql

-dmysql_datadir=/data/mysql

-dsysconfdir=/etc


5.2. The default compiled storage engine includes: CSV, MyISAM, MYISAMMRG, and heap. To install additional storage engines, the following options are:

-dwith_innobase_storage_engine=1

-dwith_archive_storage_engine=1

-dwith_blackhole_storage_engine=1

-dwith_federated_storage_engine=1


5.3. To explicitly specify that a storage engine is not compiled, you can use an option similar to the following:

-dwithout_<engine>_storage_engine=1

Like what:

-dwithout_example_storage_engine=1

-dwithout_federated_storage_engine=1

-dwithout_partition_storage_engine=1


5.4. If you want to compile other functions, you can use a library similar to the following to achieve compile time or not use a library:

-dwith_readline=1

-dwith_ssl=system #开启ssl功能

-dwith_zlib=system

-dwith_libwrap=0 #取消tcp_wrap功能


5.5. Other common options:

-dmysql_tcp_port=3306

-dmysql_unix_addr=/tmp/mysql.sock

-denabled_local_infile=1

-dextra_charsets=all

-ddefault_charset=utf8

-ddefault_collation=utf8_general_ci

-dwith_debug=0

-denable_profiling=1


5.6. If you want to clean up the files generated by the previous compilation, you need to use the following command:

Make clean

RM CMakeCache.txt


This article is from the "Xavier Willow" blog, please be sure to keep this source http://willow.blog.51cto.com/6574604/1792039

Linux under source code compilation installation MySQL detailed

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.