Linux under compilation installation MARIADB

Source: Internet
Author: User

MARIADB is an open source branch of MySQL, mainly community maintenance, and fully compatible with MySQL, and can be easily known as the replacement of MySQL, Mariadb is born out of MySQL founder Michael Widenius Hand, The name came from his daughter, Maria, because he sold MySQL to Sun and Sun was acquired by Oracle, so MySQL is owned by Oracle, so there is a risk of a closed source, and Michael Widenius developed MARIADB as an open source branch of MySQL, very good to avoid this potential problem, so MARIADB became a replacement for MySQL future, a lot of manufacturers also pay more and more attention to MARIADB, And mariadb in many aspects of the performance also better than MySQL, like the current Windows desktop PHP integrated development environment such as XAMPP and Linux and LNMP environment are used MARIADB as the default database, So moving from MySQL to MARIADB is also a trend

The first step in using MARIADB is to deploy the operating system, and now it's time to install the MARIADB on Linux in a compiled source.

First go to mariadb official website to download the installation package, home is: https://mariadb.org/


Before installing the MARIADB, first install the CMake, in addition to ensure that there is no shortage of dependencies, using Yum or RPM installation depends on: Readline-devel,zlib-devel,openssl-devel, Libaio-devel and Readline-devel depend on Ncurses-devel, and if Yum is used, it will automatically install the required dependencies, with the following specific commands:

Yum-y InstallReadline-devel
Yum-y InstallZlib-devel
Yum-y InstallOpenssl-devel
Yum-y InstallLibaio-devel

yum–y Install bison (Universal parser Generator)

Yum–y Install gcc

Yum–y Install gcc-c++

Yum-y Install CMake


Here the pre-scheduled MySQL installation directory for/usr/local/mysql and data directory for/mydata/data (data files separately stored), here to establish users and directories, and give MySQL user rights, operation as follows:

Groupadd-g 306-r MySQL
Useradd-g 306-u 306-r mysql-s/sbin/nologin
Mkdir/mydata/data (can use a separate disk, make a logical volume, mount to the/mydata directory)
Chown Mysql:mysql-r/mydata/data

You can now start the installation, unzip the installation package, and enter the directory:
Tar-xvzf mariadb-10.1.18.tar.gz
CD mariadb-10.1.21

CMake. -dcmake_install_prefix=/usr/local/mysql

-dmysql_datadir=/mydata/data-dsysconfdir=/etc-dwithout_tokudb=1-dwith_innobase_storage_engine=1-dwith_ Archive_stprage_engine=1-dwith_blackhole_storage_engine=1-dwiyh_readline=1-dwiyh_ssl=system-dvith_zlib=system- Dwith_lobwrap=0-dmysql_unix_addr=/tmp/mysql.sock-ddefault_charset=utf8-ddefault_collation=utf8_general_ci


Parameter description

# Install the root directory

-dcmake_install_prefix=/usr/local/mysql

# Data Store Directory

-dmysql_datadir=/mydata/data

# UNIX Socket File

-dmysql_unix_addr=/tmp/mysql.sock

# configuration file (my.cnf) directory

-dsysconfdir=/etc

# Default Character Set

-ddefault_charset=utf8

# Default Character Proofing

-ddefault_collation=utf8_general_ci

# TCP/IP Port

-dmysql_tcp_port=3306

# * ARCHIVE engine support

-dwith_archive_storage_engine=1

# * ARIA engine

CMake no problem, can be compiled and installed: made && make install time is a bit long, wait patiently

Execution is complete, the installation is complete, and now execute cd/usr/local/mysql/into the MySQL installation directory to execute the following command separately:

Chown-r root:mysql./*

The following steps are done after the installation is complete:

First,Mysqlinitialization of the database:mysql_install_db
Get help:scripts/mysql_install_db--help
scripts/mysql_install_db--datadir=/mydata/data--user=mysql
Second, copyMysqlStartup script:
Cpsupport-files/mysql.server/etc/init.d/mysqld
Chkconfig--addmysqld
Chkconfig Mysqldon
Third, copyMysqlconfiguration file and add the necessary options:
Cpsupport-files/my-large.cnf/etc/mysql/my.cnf
in the section[Mysqld]Add the following options:
DataDir =/mydata/data
Innodb_file_per_table = On
Skip_name_resolve = On
Four,Mysqlsecurity initialization of the database:mysql_secure_installation
for allRootuser Set password, delete anonymous user, prohibitRootremote login, etc....
v. Configuring environment Variables
Vim/etc/profile.d/mysql.sh(new)
Add:
Exportpath=/usr/local/mysql/bin:${path}

The installation is complete!

This article is from the "Linux Related Technologies" blog, make sure to keep this source http://wangergui.blog.51cto.com/8504247/1904540

Compile and install mariadb under Linux

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.