Lamp compilation Install MySQL

Source: Internet
Author: User

CMake Cross-platform compilers:

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

./configure--CMake.

./configure--help--CMake. -lh


Mysql

0. Create MySQL users and related groups:

#groupadd-R-G 306 MySQL

#useradd-R-u 306-g 306 mysql-s/sbin/nologin


1. Create a database partition and mount it:

#fdisk/dev/sdb

N

P

1

T

8e

W

#partprobe

#pvcreate/DEV/SDB1

#vgcreate MYVG/DEV/SDB1

#lvcreate-N sqld-l 10G MYVG

#mke2fs-j/dev/myvg/sqld

#mkdir/sqld

#vim/etc/fstab

/dev/mapper/myvg/sqld/sqld ext3 defaults 0 0

#mount-A

#mkdir/sqld/mdata

#chown-R Mysql:mysqsl/sqld/mdata

#chmod 755/sqld/mdata


MySQL Data location:/sqld/mdata


2. Compiling the installation

Compile using the CMake tool.

0. Install CMake and boost (4.7) and Ncurses-devel

#tar-XF boost-xxx.tar.bz2

#cd/usr/local

#mv boost-xxx Boost

#cd boost

#./bootstrap

#./b2 Install


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

Export Boost_include=/usr/include/boost

Export Boost_lib=/usr/local/bin


Boost is installed by default on/usr/local/include



#tar-XF cmake.xxx.tar.gz

#cd cmake-xxx

#./bootstrap

#make && make Install

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

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

The default cmake is installed under/usr/local/bin/cmake.


#yum-y Install Ncurses-devel


1. Compile and install MySQL

# Tar XF mysql-xxx.tar.gz

# CD Mysql-xxx

# CMake. -dcmake_install_prefix=/usr/local/mysqlxx-dmysql_datadir=/sqld/mdata-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-ddefault_charset=utf8-ddefault_collation=utf8_general_ci

#cmake. -LH getting configuration information for the current CMake

# make

# make Install



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


Detailed compilation options:

Path-Related:

-dcmake_install_prefix=/usr/local/mysql MySQL Installation path

-dmysql_datadir=/mydata/data Default data path

-DSYSCONFDIR=/ETC configuration file path



Storage Engine:

The storage engines that are compiled by default include: CSV, MyISAM, MYISAMMRG, and heap. To install additional storage engines, you can use a compilation option similar to the following:

-dwith_innobase_storage_engine=1

-dwith_archive_storage_engine=1

-dwith_blackhole_storage_engine=1

-dwith_federated_storage_engine=1


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

-dwithout_<engine>_storage_engine=1


Other Features:

If you want to compile into other functions, such as SSL, you can use a library similar to the following, or do not use a library when compiling:

-dwith_ssl=system enabling SSL-based features


-dwith_zlib=system Enable ZLIB Compression Library


-dwith_libwrap=0 does not enable the access control feature.


-dwith_boost=/usr/local/boost Specify BOOST Location


Other common options:

-dmysql_tcp_port=3306 Default Port


-dmysql_unix_addr=/tmp/mysql.sock Default Socket path


-denabled_local_infile=1 the way to enable Loadinfile.


-dextra_charsets=all enable character set support.


-ddefault_charset=utf8 specifying the default character set


-DDEFAULT_COLLATION=UTF8_GENERAL_CI Specifies the default character set collation.


-dwith_debug=0 does not enable the DEBUG feature.


-denable_profiling=1 enable the profiling feature.



3. Create soft links to facilitate multi-version coexistence. Also, change the folder's group back to MySQL to avoid security issues.

#ln-sv/usr/local/mysqlxx/usr/local/mysql

#chown-R: mysql/usr/local/mysqlxx/


4. Add Environment variables:

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

Export path= $PAHT:/usr/local/mysql/bin


5. Add a man document path

#vim/etc/man_db.conf

Mandatory_manpath/usr/local/mysql/man


6. Add the library file.

#vim/etc/ld.so.conf.d/mysql.conf

/usr/local/mysql/lib

#ldconfig-V System re-establishes the library file cache, the cache file is/etc/ld.so.cache


7. Add a header file:

#ln-sv/usr/local/mysql/include/usr/include/mysql



8. Initialize MySQL:

#cd/usr/local/mysql

#scripts/mysql_install_db \

>--USER=MYSQL Specifies to run mysqld as a user.

>--DATADIR=/SQLD/MDATA Specifies the location of the MySQL database. The default is placed under/usr/local/mysql/mdata.


9. Replication Service Script:

#cp/usr/local/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqld


10. Edit the MySQL configuration file

#vim/usr/local/mysql/my.cnf

thread_concurrency=8 thread concurrency, number of CPUs

datadir=/sqld/mdata/specifies the data location.


Note: The profile/usr/local/mysql/my.cnf has the highest priority, can be selected to be replaced in/etc, or it can be used directly after the/ETC/MY.CNF is deleted.


11. Start the service:

#systemctl Start mysqld


This article is from "Small Private blog" blog, please be sure to keep this source http://ggvylf.blog.51cto.com/784661/1654511

Lamp compilation Install MySQL

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.