Centos7.3 binary Format Installation mariadb

Source: Internet
Author: User

Centos7.3 binary Format Installation mariadb

background:

CentOS7 started with the database using the MARIADB database, and Yum installed a relatively low database version, so learned in the CentOS7.3 version of the binary installation MariaDB-10.2.8, in this record installation process for later reference. The binary installation is primarily designed to eliminate the time to compile and install, which is too long to compile.

mariadb Introduction:

mariadb is a change from MySQL, MySQL has not developed well after Oracle acquisition, after all, Oracle company has its own database Oracle, So the father of MySQL left Oracle company to build a new company to develop MARIADB, and mariadb a big replacement for MySQL trend, now many large companies are moving databases to MARIADB. In the CentOS7 version, we replaced MySQL directly with MARIADB.

Installation steps:

(1) Prepare the user

We need to prepare a MySQL user group with a group ID of 306:

Groupadd-r-G 306 MySQL

In creating a MySQL user, the user ID is 306 and the owning group is 306:

Useradd-r-G 306-u 306–m–d/app/data MySQL

(2) Prepare the database storage path, this directory will hold the database data, will be more and more large, it is recommended to use logical volume, but here I use a partition under the/app/data directory to do the data directory:

Chown Mysql:mysql/app/data Modify the directory's owner and all groups for MySQL

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/07/4E/wKiom1nHY46hjpzYAAAUN2EMz8Q960.png "title=" 1.png "alt=" Wkiom1nhy46hjpzyaaaun2emz8q960.png "/>

(3) Prepare the binary program

Binary program can go to mariadb official website download: https://downloads.mariadb.org/

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/A5/FF/wKioL1nHZJXDLIlSAADDqhE7IW0567.png "title=" 2.png "alt=" Wkiol1nhzjxdlilsaaddqhe7iw0567.png "/>


Note that the download is a binary installation package, will be much larger than the source package, after all, as well as compiled files, there is attention to Windows and Linux.

After the download is placed anywhere, and then extracted to the/usr/loacl directory, you can also be puzzled to compress to this file, but you need to modify a lot of configuration files, because the default directory is this, it is best not to modify.

MARIADB and MySQL usage are the same, but also with the MySQL command, so the configuration and startup are related to MySQL, after all, essentially they are the same.

Tar xvf mariadb-10.2.8-linux-x86_64.tar.gz-c/usr/local/

After decompression: cd/usr/local

Create a soft connection: LN-SV mariadb-10.2.8-linux-x86_64 MySQL

Change the owner and group of MySQL directory and sub-files:

Chown-r root:mysql/usr/local/mysql/

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/A5/FF/wKioL1nHaHvDWHDtAAAlrUvwRM8330.png "title=" 3.png "alt=" Wkiol1nhahvdwhdtaaalruvwrm8330.png "/>

(4) Preparing the configuration file

Create MySQL configuration directory: Mkdir/etc/mysql

To copy a configuration file:

Cp/usr/loacl/mysql/support-files/my-large.cnf/etc/mysql/my.cnf

To modify a configuration file:

Add three options in [mysqld]:
DataDir =/app/data Specify Database storage directory
Innodb_file_per_table = On
Skip_name_resolve = ON disables hostname resolution

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/07/4F/wKiom1nHarLwvDjLAAAfRn4Nq50559.png "title=" 4.png "alt=" Wkiom1nharlwvdjlaaafrn4nq50559.png "/>

(5) Create a database file

Go to the MySQL directory (must be into this directory, not in the directory to go Down):

cd/usr/local/mysql/
Create a database file with the script it prepares:

./scripts/mysql_install_db--datadir=/app/data--user=mysql

--datadir followed by the directory where the database is stored

--user is followed by the user

If this step error may be missing some library files, install the library files as prompted to

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/07/4F/wKiom1nHbA_Dg_2AAACrcR5g-_g518.png "title=" 5.png "alt=" Wkiom1nhba_dg_2aaacrcr5g-_g518.png "/> (6) Prepare the log file

Create log file: Touch/var/log/mysqld.log
Modify file owner: Chown mysql/var/log/mysqld.log

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/07/4F/wKiom1nHbTKjkVCJAAATs2ksFJc460.png "title=" 6.png "alt=" Wkiom1nhbtkjkvcjaaats2ksfjc460.png "/>

(7) Prepare the service script and start the service

Copy Mysql.server to INIT.D:

CP./support-files/mysql.server/etc/rc.d/init.d/mysqld
Add Service: Chkconfig--add mysqld
Start service: Systemctl start mysqld

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/07/4F/wKiom1nHblaSJ12xAAA35JU8pYc396.png "title=" 7.png "alt=" Wkiom1nhblasj12xaaa35ju8pyc396.png "/>

(8) Security initialization

Command:/user/local/mysql/bin/mysql_secure_installatio

Role: Set the account password and whether to allow anonymous login and whether to clear empty account and so on

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/07/4F/wKiom1nHbxmAqSEzAAB056lG928693.png "title=" 8.png "alt=" Wkiom1nhbxmaqsezaab056lg928693.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/A6/00/wKioL1nHb2XzQ3XSAABsZDDaloo270.png "title=" 9.png "alt=" Wkiol1nhb2xzq3xsaabszddaloo270.png "/>

(9) At this time MARIADB service has been opened, users can use the MARIADB database, but for the convenience of this machine, we also need to set the path variable, otherwise use the MySQL command need to write a long directory

Create a script in/etc/profile.d/mysqld.sh

Command: vim/etc/profile.d/mysqld.sh

Write to export path=/usr/local/mysql/bin: $PATH

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/07/4F/wKiom1nHcKDSwL_RAAAJ1diGoKw232.png "title=" 10. PNG "alt=" Wkiom1nhckdswl_raaaj1digokw232.png "/>

: Wq save exit; load this configuration file

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/A6/00/wKioL1nHcQvBEV5oAAAV_mbDNk8709.png "title=" 11. PNG "alt=" Wkiol1nhcqvbev5oaaav_mbdnk8709.png "/>

(10) using the MARIADB database

Here we can use MySQL command to connect the database and use the database.

Connection Database command: mysql-uroot-p

-uroot Sign in username

-P Indicates the password, if no password can not write, there is a password can be directly followed, but not safe

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/07/4F/wKiom1nHcdHzJxKwAAB38r6dWkU685.png "title=" 12. PNG "alt=" Wkiom1nhcdhzjxkwaab38r6dwku685.png "/>


This article is from the "Linux" blog, so be sure to keep this source http://13139261.blog.51cto.com/13129261/1968201

Centos7.3 binary Format Installation mariadb

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.