Source Code Compilation Installation mariadb-5.5.48
MARIADB Introduction
MARIADB database management System is a branch of MySQL, mainly by the open source community in the maintenance, the use of GPL license. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting MySQL out of the source, so the community uses a branching approach to avoid this risk. MARIADB is designed to be fully compatible with MySQL, including APIs and command lines, making it easy to be a replacement for MySQL. For the storage engine, use XtraDB (English: XtraDB) instead of the MySQL InnoDB. MARIADB, led by MySQL's founder Michael Widenius (English: Michael Widenius), sold his company, MySQL AB, to Sun for $1 billion earlier, and since Sun was acquired by Oracle, MySQL's ownership also falls into Oracle's hands. Mariadb name comes from Michael Widenius's daughter Maria's name.
MARIADB, the transaction-based Maria Storage engine, replaces the MySQL MyISAM storage engine, which uses a variant of the Percona Xtradb,innodb, which the branch developers want to provide access to the upcoming MySQL 5.4 InnoDB performance. This version also includes the PrimeBase XT (PBXT) and Federatedx storage engines.
MySQL since 5.5, the compiled installation project code management is not using make, but instead uses the CMake. One of the important characteristics of CMake is its independent of the source code (OUT-OF-SOURCE) of the compilation function, that is, the compilation work can be in another specified directory rather than the source directory, which can ensure that the source directory is not affected by any one compilation, so in the same source tree can be many different compilations, CMake is not installed by default, such as compiling for different platforms, and compiling the installation to prepare the development environment.
Compiling and installing maridb-5.5.48
Preparatory work
1, operating system environment for centos-6.7
2, official website download https://downloads.mariadb.org/mariadb/5.5.48/maridb-5.5.48.tar.gz
#wget https://downloads.mariadb.org/mariadb/5.5.48/maridb-5.5.48.tar.gz
3, prepare Epel source
#rpm-UVH HTTP://MIRRORS.USTC.EDU.CN/FEDORA/EPEL/6/X86_64/EPEL-RELEASE-6-8.NOARCH.RPM#RPM-UVH/http Rpms.famillecollet.com/enterprise/remi-release-6.rpm#yum Makecache #重建缓存
4. Epel Source Yum Installation Development Environment Group
#yum Groupinstall "Development Tools" "Server Platform Development" "Server Platform"-y
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/7F/C4/wKiom1cr4KriLslHAAaA4b25CAc364.jpg "title=" 1.jpg " alt= "Wkiom1cr4krilslhaaaa4b25cac364.jpg"/>
5, Epel source Yum installation CMake (can also use the download source package compiled installation, here do not explain)
# yum Install Cmake-y
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/7F/C2/wKioL1cr4ZvBbVHlAARBShF7uQM534.jpg "title=" 2.jpg " alt= "Wkiol1cr4zvbbvhlaarbshf7uqm534.jpg"/>
First, CMake compile and install maridb-5.5.48
1, cmake Common compilation configuration
Specifies 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
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
Like what:
-dwithout_example_storage_engine=1
-dwithout_federated_storage_engine=1
-dwithout_partition_storage_engine=1
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_readline=1
-dwith_ssl=system
-dwith_zlib=system
-dwith_libwrap=0
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
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
2. Add MySQL user and MySQL group, create data directory/mydata/data and give MySQL user
# mkdir-pv/mydata/data# Groupadd-r mysql# useradd-g mysql-r mysql# chown-r mysql:mysql/mydata/data
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/7F/C5/wKiom1cr4ODAYjbHAAI7qn_u3yA510.jpg "title=" 3.jpg " alt= "Wkiom1cr4odayjbhaai7qn_u3ya510.jpg"/>
3, unzip the installation of the compilation
# tar XF mariadb-5.5.48.tar.gz-c/usr/local/# cd/usr/local/mariadb-5.5.48# cmake. -dcmake_install_prefix=/usr/local/mariadb-5.5.48-dmysql_datadir=/mydata/data-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
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/7F/C2/wKioL1cr4drS7grvAAP6beIsN5s855.jpg "style=" float: none; "title=" 4.jpg "alt=" Wkiol1cr4drs7grvaap6beisn5s855.jpg "/>
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/7F/C2/wKioL1cr4d3QJGJCAAJue9lFGJ4225.jpg "style=" float: none; "title=" 5.jpg "alt=" Wkiol1cr4d3qjgjcaajue9lfgj4225.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/7F/C2/wKioL1cr4d_QhI0hAAFIho32Yf8139.jpg "style=" float: none; "title=" 6.jpg "alt=" Wkiol1cr4d_qhi0haafiho32yf8139.jpg "/>
4. Create a link to MySQL and modify all the files in the MySQL directory to belong to a group of users
#ln-sv/usr/local/mariadb-5.5.48/usr/local/mysql# cd mysql/# chown root.mysql./*
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/7F/C5/wKiom1cr4SuiM2JTAAMypFZVoAs266.jpg "title=" 7.jpg " alt= "Wkiom1cr4suim2jtaamypfzvoas266.jpg"/>
5. Initialize the database
#./scripts/mysql_install_db--user=mysql--datadir=/mydata/data
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/7F/C2/wKioL1cr4huyMtXIAAQAeFbsWME406.jpg "title=" 11.jpg "alt=" Wkiol1cr4huymtxiaaqaefbswme406.jpg "/>
6. Copy and modify the service configuration file
# cp support-files/my-large.cnf/etc/my.cnf# VIM/ETC/MY.CNF [mysqld] #在此组字段下添加datadir =/mydata/datathread_concurrency = 2 #设置核心数, according to the actual situation set innodb_file_per_table = on #启用独立表空间模式, each table generates a table space skip_name_resolve = on #禁用域名反解析
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/7F/C2/wKioL1cr4i_jWzNsAADMaqH453g630.jpg "title=" 9.jpg " alt= "Wkiol1cr4i_jwznsaadmaqh453g630.jpg"/>
7. Create a service file and test the startup service
# CP support-files/mysql.server/etc/rc.d/init.d/mysqld# chmod +x/etc/rc.d/init.d/mysqld# service mysqld start
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/7F/C5/wKiom1cr4WjxQJKTAADSWlGfO10601.jpg "title=" 8.jpg " alt= "Wkiom1cr4wjxqjktaadswlgfo10601.jpg"/>
8. Add the MySQL command to the path variable and connect the test
# Vim/etc/profile.d/mysql.shexport Path=/usr/local/mysql/bin: $PATH # chmod +x mysql.sh Add Execute Permissions #. /ETC/PROFILE.D/MYSQL.SH implementation takes effect
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/7F/C5/wKiom1cr4Yvj8c7TAAKvzGyuFBE799.jpg "style=" float: none; "title=" 10.jpg "alt=" Wkiom1cr4yvj8c7taakvzgyufbe799.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/7F/C5/wKiom1cr4Y6zyp8WAALn46qa_qY665.jpg "style=" float: none; "title=" 12.jpg "alt=" Wkiom1cr4y6zyp8waaln46qa_qy665.jpg "/>
This article is from the "10,000-hour Law" blog, be sure to keep this source http://daisywei.blog.51cto.com/7837970/1770621
Source Code Compilation Installation mariadb-5.5.48