Centos 6 under use cmake to compile and install MariaDB

EDITORIAL

A recent study Maria DB, in order to facilitate access to, and knowledge in order to re-combing learned, especially as this essay one, I hope you can sense when after reading, I hope all of you can help.

Preparing for Installation

As we all know, install the software on a Linux There are three ways: 1, rpm package installation. 2, binary package installation. 3, source compiler installation. For the first two will be convenient way to install a lot, but the low level of customization, when we need software diy, then compile and install it appropriate.

For CentOS 6, using yum install, yum inside source provided by default is a low version of MySQL, so when we want to install Maria DB, you need to use to compile and install. After CentOS 7, yum source may be used directly in accordance with MariaDB.

1, packets dependent libraries and

 Before compiling, we need to install some libraries and packages since

yum -y groupinstall "Development tools" " Server Platform Development" # both libraries contain many commonly used software, for example openssl-devel, bison and other 
yum -y lrzsz install cmake lrzsz # here is a physical machine, and software for transferring files between virtual machines, the package will be later copied from a physical machine to a virtual machine.

 2. Other related settings

-R & lt -g Grouped 306 MySQL # Add a system group 
useraddd -R & lt -u 306 -g 306 MySQL # add a user system corresponding to the system and added to the group 

mkdir -p / Data / MySQL MariaDB disposed to correspond to catalog # 
chown -R & lt mysql.mysql / data / mysql # corresponding to the change is a group owner, in order to write data

Installation mariaDB

1, extract the folder to formulate

Because here is rz # MariaDB into a physical desktop machine, using this command to transfer 
the tar -xf MariaDB-10.0.13.tar.gz 
CD-10.0.13.tar.gz MariaDB

2, installation

cmake -DCMAKE_INSTALL_PREFIX = / usr / local / mysql \ # installation directory is / usr / local / mysql, mysql directory which can not be established in advance.
-DMYSQL_DATADIR = / data / mysql \ # data storage directory, the need to establish in advance, and set is a group owner, the owner is a group corresponding to read and write data to facilitate
-DWITH_XTRADB_STORAGE_ENGINE = 1 \ # existing default MyISAM storage engine and CSV thus adding FEDERATEDX, ARCHIVE, MYISAM, INNOBASE, BLACKHOLE storage engine. InnoDB among the most common.
= 1 -DWITH_FEDERATEDX_STORAGE_ENGINE \
-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DWITH_SSL = System \ # added ssl, zlib library 
-DWITH_ZLIB = System \
-DDEFAULT_CHARSET = utf8 \ # Character Set
-DDEFAULT_COLLATION = utf8_general_ci # set Sort

Note: This step occurs when

-- Configuring done
-- Generating done

"When, for following installation.

This procedure will produce a "CMakeCache.txt" file, when problems arise, it is necessary to remove recompiled.

make

make install

After the installation is complete

1, MariaDB adding environment variables  

/etc/profile.d/ vim mysql.sh 
  Export the PATH = $ the PATH: / usr / local / MySQL / bin # join this content 
. /etc/profile.d/mysql.sh # reload it into effect, must be ending .sh, otherwise only the current session to take effect.

2, set the configuration file and initialize

chown -R mysql.mysql / usr / local / mysql # Set the owner and the array, to facilitate the configuration file 
CD / usr / local / MySQL CP Support -files / My-large.cnf / etc / the my.cnf # adding configure file and add the following three lines configuration information [mysqld] in   "DATADIR = / Data / MySQL /   the innodb_file_per_table = oN   skip_name_resolve = oN" scripts / MySQL --datadir the mysql_install_db --user = = / Data / MySQL # Note: this initialization scripts must be performed / usrl / local / mysql this directory, otherwise it will error.
  After initialization, the data directory there will be some original data

    ls /data/mysql/
    aria_log.00000001 ib_logfile0 mysql-bin.000001 mysql-bin.state
    aria_log_control ib_logfile1 mysql-bin.000002 performance_schema
    ibdata1 mysql mysql-bin.index test

3, added to the system startup items

Support-Files cp / /etc/init.d/ mysql.server mysqld     
 chmod + the X-/etc/init.d/ mysqld # execute permission to the script to increase 
 chkconfig mysqld on # Join boot entry

4, MariaDB user security initialization

/ usr / local / MySQL / bin / mysql_secure_installation 
# This step will set the root password to prohibit root remote login, removing a user, delete the test database, and reload the grant tables. You can choose according to their preferences.
PS: When MariaDB start, began to carry out this operation.

5, registration operation

[root @ mycentos ~] #-uroot-MySQL - the p-# login command, log in as the root user password is set on the step of the operation. 
Password the Enter: 
is available for purchase at The MariaDB to Monitor Commands End with; or \ G.. 
Your MariaDB Connection the above mentioned id IS  15 
Server Version: 10.0 . 13 -MariaDB- log Source Distribution's # here MariaDB version 

Copyright (c) 2000 , 2014 , . the Oracle, SkySQL Others Ab and 

the Type ' Help; ' or ' \ H '  for Help the Type. ' \ C ' to Clear The Current INPUT Statement. 
  
MariaDB [(none)]> # Has been entered into the database, compile the installation! ! !

 

  

Guess you like

Origin www.cnblogs.com/liuxiantong/p/11583307.html