CentOS 7 Compile and install Mariadb-10.2.11

Source: Internet
Author: User
Tags chmod openssl temporary file storage

1. Install the development environment

Package Required for installation:

1

yum install -y ncurses-devel openssl-devel zlib-devel ncurses-devel openssl gcc gcc-c++

2. Installing CMake

12345 tar -zvxf cmake-3.8.0.tar.gz -C /usr/local/src
cd /usr/local/src/cmake-3.8.0./bootstrapmakemake install

3. Preparation before installation

3.1. Prepare the Catalogue

1 mkdir -pv /data/mysql/3306/{data,logs/{binlog,relaylog},run,tmp}

3.2. Add Users

Groupadd-g 3306 mysqluseradd-u 3306-g 3306-s/sbin/nologin-m MySQL
chown mysql:mysql /data/mysql/ 3306 / -R

4. Compiling the installation

123456789101112131415161718192021222324 # tar -xf mariadb-10.1.22.tar.gz -C /usr/local/src
# cd mariadb-10.1.22# cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\-DMYSQL_DATADIR=/data/mysql/3306/data\-DSYSCONFDIR=/etc\-DMYSQL_USER=mysql \-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 \-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \-DENABLED_LOCAL_INFILE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1  \-DWITH_DEBUG=0 \-DWITHOUT_MROONGA_STORAGE_ENGINE=1# make

# make install

-dcmake_install_prefix=/usr/local/mysql \ # Install root directory
-dmysql_datadir=/data/mysql/data \ # data Store directory
-DTMPDIR=/DATA/MYSQL/TMP \ # temporary file storage directory
-dmysql_unix_addr=/data/mysql/run/mysqld.sock \ # UNIX Socket file
-DSYSCONFDIR=/ETC \ # configuration file storage Directory
-dwith_myisam_storage_engine=1 \ # MYISAM engine support
-dwith_innobase_storage_engine=1 \ # InnoDB engine support
-dwith_archive_storage_engine=1 \ # ARCHIVE engine support
-dwith_blackhole_storage_engine=1 \ # Blackhole engine support
-dwith_perfschema_storage_engine=1 \ # Perfschema engine support
-dwith_federated_storage_engine=1 \ # Federatedx engine support
-dwith_tokudb_storage_engine=1 \ # TOKUDB engine support
-dwith_xtradb_storage_engine=1 \ # XTRADB engine support
-dwith_aria_storage_engine=1 \ # ARIA engine support
-dwith_partition_storage_engine=1 \ # PARTITION engine support
-dwith_sphinx_storage_engine=1 \ # SPHINX engine support
-dwith_readline=1 \ # READLINE Library
-dmysql_tcp_port=3306 \ # TCP/IP Port
-denabled_local_infile=1 \ # Enable loading of local data
-dwith_extra_charsets=all \ # Extended Support encoding (all | utf8,gbk,gb2312 | none)
-dextra_charsets=all \ # Extended character support
-DDEFAULT_CHARSET=UTF8 \ # Default Character set
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \ # Default character proofing
-dcmake_exe_linker_flags= '-ljemalloc ' \ # Jemalloc Memory Management Library
-dwith_safemalloc=off \ # Turn off default memory management
-dwith_debug=0 \ # Turn off debug mode
-denable_profiling=1 \ # Enable profiling feature
-dwith_ssl=system \ # using the own SSL library on the system
-dwith_zlib=system \ # Using the ZLIB library that comes with the system
-dwith_libwrap=0 # Disable LibWrap library

5. Preparation of the environment after installation

12 # chmod +w /usr/local/mysql/# chown -R mysql:mysql /usr/local/mysql/

6. Copy the configuration file and modify

1 # cp support-files/my-large.cnf /etc/my.cnf
1 # vim /etc/my.cnf

Add the following:

1234 datadir = /data/mysql/3306/datainnodb_flush_log_at_trx_commit = 2innodb_file_per_table = ONskip_name_resolve = ON

To view the configuration file:

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 vim /etc/my.cnf[client]port            = 3306socket          = /tmp/mysql.sock[mysqld]port            = 3306socket          = /tmp/mysql.sockskip-external-lockingkey_buffer_size = 256Mmax_allowed_packet = 1Mtable_open_cache = 256sort_buffer_size = 1Mread_buffer_size = 1Mread_rnd_buffer_size = 4Mmyisam_sort_buffer_size = 64Mthread_cache_size = 8query_cache_size= 16Mthread_concurrency = 8log-bin=mysql-binbinlog_format=mixedserver-id       = 1datadir = /data/mysql/3306/datainnodb_data_home_dir = /data/mysql/3306/datainnodb_data_file_path = ibdata1:10M:autoextendinnodb_log_group_home_dir = /data/mysql/3306/datainnodb_buffer_pool_size = 256Minnodb_additional_mem_pool_size = 20Minnodb_log_file_size = 64Minnodb_log_buffer_size = 8Minnodb_flush_log_at_trx_commit = 2innodb_lock_wait_timeout = 50innodb_file_per_table = ONskip_name_resolve = ON[mysqldump]quickmax_allowed_packet = 16M[mysql]no-auto-rehash [myisamchk]key_buffer_size = 128Msort_buffer_size = 128Mread_buffer = 2Mwrite_buffer = 2M[mysqlhotcopy]interactive-timeout


7. Initialize MySQL

1 # scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/3306/data/ --defaults-file=/etc/my.cnf


To view the results of the initialization:

123 # ls /data/mysql/3306/data/aria_log.00000001ibdata1      ib_logfile1  mysql-bin.000001  mysql-bin.000003 mysql-bin.state     testaria_log_control   ib_logfile0  mysql        mysql-bin.000002mysql-bin.index   performance_schema

8. Start the service

1234 # cp support-files/mysql.server /etc/rc.d/init.d/mysqld# chmod +x /etc/rc.d/init.d/mysqld # chkconfig --add mysqld# service mysqld start

9. Add Environment variables

12 # vim /etc/profileexport PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin


Reread environment variables

1 source /etc/profile


10. Initializing the Database user table

12345678910 # mysqlWelcome to the MariaDB monitor.  Commands end with; or \g.Your MariaDB connection id is4Server version: 10.1.22-MariaDB Source distributionCopyright (c) 20002016, Oracle, MariaDB Corporation Ab and others.Type 'help;'or '\h'forhelp. Type '\c' to clear the current input statement.MariaDB [(none)]> usemysqlDatabase changedMariaDB [mysql]> deletefrom user where host='localhost.localdomain'or host='127.0.0.1'or host='::1'or user='';Query OK, 5rows affected (0.00sec)


http://blog.51cto.com/ckl893/1920592

CentOS 7 Compile and install Mariadb-10.2.11

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.