MARIADB Universal Binary Format installation

Source: Internet
Author: User

First, MARIADB installation introduction:

For a generic binary format package, we only need to be able to use the database after extracting it, it sounds easy, but there are some problems to be aware of. Binary format package is a compiled binary program, so there are many scripts are executed under a fixed path, so the installation process MySQL This path must be installed in the/usr/local directory, and the directory name must be called MySQL. If you don't set it up, some scripts won't work, let alone a successful installation.

MARIADB General binary format related file description

When you get to the MARIADB generic binary format file, unzip it to view its files as follows:

    [[email protected] etc]# ls  /usr/local/mysql/        bin              data                INSTALL-BINARY  mysql-test  share         COPYING         EXCEPTIONS-CLIENT   lib             readme       sql-bench        copying. lesser  include            man              scripts      Support-files 

Bin: Executable binary file storage directory

Data: If we do not create a new directory, this directory is the default directory. So at least the group is MySQL

Install-binary: Installation help information, so before installing can read the following this file content, described very detailed, than I write much better. If you do not understand, then see this version of it 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0059.gif "alt=" J_0059.gif "/>

Mysql-test:mysql Test related components, there are documents, interested can look at, I do not describe in detail

Shared content of Share:mysql

Lib:mysql run the library file that needs to be called

Sql-bench: Do stress testing tools for MySQL and discuss this later

Man: Help Manual

Scripts:mysql the script to be used when initializing, read through the script content to let you know some MySQL installation process

Support-files:mysql normal operation of the eye-sex profile or document

Include: Header file

README: Software Documentation

Note: The data listed above is the default directory for database files, but if enterprise data grows rapidly in the enterprise, it will be very large, and the security and scalability are not good. So it's safer to do it or store it on another disk.

Second, general-purpose binary format installation mariadb steps:

1. Preparatory work

1.1 Creating the Database installation directory

~]# Mkdir/mydata/data

1.2 Add a system user named MySQL, and the user group is MySQL

~]# Useradd-r MySQL # The owner group created by default is Mysql;-r, which means that the system user is created.

1.3 Get the MARIADB binary source installation package.

Download the mariadb-5.5.46-linux-x86_64.tar.gz package in the MARIADB official site www.mariadb.org and copy it to the Linux server.

2, the installation package decompression to the/usr/local path (not to mention it, if not understand here, please re-read this article)

~]# TAR-ZXVF mariadb-5.5.46-linux-x86_64.tar.gz-c/usr/local/

3, modify the path of the compressed file (using the method of soft link, the extracted file link to the current directory of MySQL)

~]# cd/usr/local ~]# ln-sv mariadb-5.5.46-linux-x86_64./mysql

4, check the/usr/local/mysql (in fact, the source file is/usr/local/mariadb-5.5.46-linux-x86_64, but we can only use/usr/local/mysql substitution) of the genus of the main group is not MySQL, Need us to manually change

~]# ll/usr/local/mysql/#查看mysql目录下的属组与属组 ~]# chown-r root.mysql/usr/local/mysql/* #只要文件的属组为mysql即可

5. Pre-Initial preparation

There are a lot of sample configuration files in/usr/local/mysql/support-file,

~]# ls/usr/local/mysql/support-files/binary-configure my-innodb-heavy-4g.cnf my-small.cnf mysql.se RVer Magic my-large.cnf mysqld_multi.server SELinux my-huge.cnf my-m EDIUM.CNF mysql-log-rotate

Description

Database configuration files for different scenarios: (The memory size is not very exact, here is just an example to make it easy to understand)

MY-SMALL.CNF: Low memory usage, usually around 64M

MY-MEDIUM.CNF: Memory use medium, generally around 256M

MY-LARGE.CNF: Use larger memory, usually around 512M

MY-HUGE.CNF: Huge memory usage, up to a few grams

My-innodb-heaby-4g.cnf:innodb database engine, memory at least 4G

Configuration file:

Mysql.server:mysql Service management file, related to start, stop, status, reload of the service

5.1 Select the MySQL configuration file and copy it to/etc/mysql/and modify it

~] #mkdir/etc/mysql #/etc directory does not exist in MySQL directory, you need to create ~]# manually cp/usr/local/mysql/support-files/my-large.cnf/etc/mysql/my.cnf #将选择的配置文件复制到/etc/mysql/, rename to My.cnf
   ~]# vim /etc/mysql/my.cnf      #编辑配置文件在 [mysqld]  below to fill in three statements       [mysqld]          datadir = /mydata/data                 #设定数据文件存放位置                         innodb_file_per_table  = ON        #                         skip_ name_resolve = on            #  Bypass Host name Resolution 

         you can see a my.cnf configuration file in the/etc/directory before you modify it, which is mysql-libs generated. We created the/ETC/MYSQL/MYCNF configuration file to view this two files:

   ~]# vim /etc/my.cnf                [mysqld]        datadir=/var/lib/mysql         socket=/var/lib/mysql/mysql.sock         symbolic-links=0[mysqld_safe]        log-error=/var/ The MARIADB directory does not exist in log/mariadb/mariadb.log   #/var/log/, it needs to be created manually, or the entry is logged off, or the service will fail when it is started.         pid-file=/var/run/mariadb/mariadb.pid         !includedir /etc/my.cnf.d  ~]# vim /etc/mysql/my.cnf          [mysqld]        port             = 3306         socket          = /tmp/mysql.sock         thread_concurrency = 8        datadir =  /mydata/data         #两个文件中的socket文件指向的文件路径不同 by looking at/var/lib/mysql/ mysql.sock  and/tmp/mysql.sock  files can tell that the configuration file is in effect.

5.2 Copy the MySQL service management file to the/etc/init.d/directory and rename it to Mysqld

~]# cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld ~]# chkconfig--add mysqld #将mysqld服务加入到开启启动项中

6. Program initialization

~]#/usr/local/mysql/scripts/mysql_install_db--user=mysql--datadir=/mydata/data--user: Specifies the user to run this program--datadir: Specify The location where the data file is stored.

7. Start the service

~]# Service mysqld Start

Note: if the/etc/my.cnf mentioned in section 5.1 is not changed, the following error will appear when the service starts.

Starting MySQL. error!
The MARIADB directory exists in/var/log/because the path that Log-error=/var/log/mariadb/mariadb.log points to is invalid.

Workaround for this problem:

A, Mv/etc/my.cnf/etc/my.cnf.bak #使/etc/my.cnf failure

b, vim/etc/my.cnf # write off the Log-error=/var/log/mariadb/mariadb.log

C, mkdir/var/log/mariadb # Create mariadb directory.

8. Verification

   ~]# ss -ntl       State       Recv-Q Send-Q               Local Address:Port                 Peer Address:Port                    LISTEN     0       50                               *:3306                             *:*                         listen     0       128                              *:22                               *:*                         LISTEN      0      100                      127.0.0.1:25                               *:*                        :3306 mysql port number has been monitored

9, at this time the database must be started with absolute path, if you want to start the normal startup need to add MySQL file path in the $path variable

~]# vim/etc/profile.d/mysql.sh

Export Path=/usr/local/mysql/bin: $PATH

~]# source/etc/profile.d/mysql.sh #重新读取配置文件
10. Lead-in document

If we need him to develop, or rely on other programs to compile, we need to export

~]# ln-sv/usr/local/mysql/include//usr/include/mysql '/usr/include/mysql '/usr/local/mysql/include/'

11. Export the library file

~]# Vim/etc/ld.so.conf.d/mysql.conf/usr/local/mysql/lib

12. Start MySQL

        

  ~]# mysql         #启动mysql数据库, restart the MySQL service if it fails to start   service mysqld restart        welcome to  the MariaDB monitor.  Commands end with ; or \g.                 your mariadb  connection id is 3                 Server version: 5.5.46-MariaDB-log MariaDB Server                 Copyright  (c)  2000, 2015, Oracle, MariaDB Corporation Ab and others.                 Type  ' help; '  or  ' \h '  for help. type  ' \c '  to clear the current input statement.           mariadb [(None)]>

Universal binary Format MARIADB installation is complete, you can use it. Don't thank me, Mi-da ~










MARIADB Universal Binary Format installation

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.