MARIADB Binary Package Installation method

Source: Internet
Author: User
Tags prepare

There are three ways to install Packages: Source package installation, binary package installation, RPM package installation. Each of the three installation methods has advantages and disadvantages. RPM Installation: Suitable for small environment, the core functions are equipped, quickly set up the environment, but its version is generally not too high; binary installation: It is published in pre-compiled, not only to avoid the compilation of the trouble, but also provide enhanced features; compile and install: it requires a high, compile environment, compile to specify almost all options, All your options are met.

Today is the installation of binary mode, it solves the issue of the version, and will not be like the source code compilation requires us to spend a lot of time to compile. For binary format packages, we only need to be able to use the database after decompression, which 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 during the installation we must follow the installation information it gives to install. Install mariadb its installation path must be 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.

Installation steps:

1. Download binary Package

2. Unzip to the installation directory to view the built-in installation information

3. Prepare the configuration file

4. Prepare the database

5. Prepare the log file

6. Prepare the service script

7. Security initialization

Installation process:

1, download the binary package. is: https://downloads.mariadb.org/

I choose the latest version of the mariadb-10.2.8 stable version, and then download the Linux x86_64 version for 64-bit operating system.

    

There's a different binary package for each version, I choose the second one, it's a generic installation package in Linux. The following is an installation package for the SYSTEMD system, and the last installation package requires your GLIBC library version to be at least 2.14.

2. Unzip to the installation directory

Upload to Linux when the download is complete, then unzip

TAR-XVF mariadb-10.2.8-linux-x86_64.tar.gz

Then go to the directory to view the installation information given inside

Cat Install-binary

According to the installation of the reminder we go to prepare the configuration file

3. Prepare the configuration file

According to the file we want to create a MySQL user, it can manage the future MySQL database, and we can also specify the MySQL home directory, so that its storage data can be placed independently, and also indicate that the shell type is Nologin

Useradd-r-m-d/app/date-s/sbin/nologin MySQL

Move the extracted directory to/usr/local/, and also create a MySQL soft connection, so that you can easily update the later version

MV Mariadb-10.2.8-linux-x86_64/usr/local

cd/usr/local; LN-SV mariadb-10.2.8-linux-x86_64 MySQL

Then you have to manage this directory for MySQL

Chown-r Root:mysql mysql/

Provide the MySQL configuration file, the unpacked package contains several provided configuration files. Placed in the Support-files directory, we can choose which profile to use based on the size of the data you want to create.

     

This selects the largest huge configuration file for copying and puts it into the specified directory to avoid possible conflicts with older versions.

mkdir/etc/mysql/

CP SUPPORT-FILES/MY-HUGE.CNF/ETC/MYSQL/MY.CNF

Write the configuration file inside

Vim/etc/mysql/my.cnf

The annotated three lines are added to the back of the mysqld to indicate where the data is stored and to facilitate later management of the table.

4. Prepare database files

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

After execution it will give some alert information, of course, these alert messages can be ignored

5. Prepare the log file

Prepare the log file so that it can be useful for future troubleshooting. Of course, because this service is MySQL management, and MySQL is/var/log/This directory does not have write permission, so here we also need to give MySQL an ACL of special permission to line

The default storage directory for MKDIR/VAR/LOG/MARIADB/MARIADB is mariadb, so create a directory that holds MARIADB logs

Touch/var/log/mariadb/mariadb.log create an empty file to put the log in again

Setfacl-r-M U:mysql:rwx/var/log/mariadb/mariadb.log gives MySQL a special permission on an ACL so that it can read and write logs

6. Prepare the service script

Here MARIADB binary package is installed. We're going to start this service now, so we need to prepare the startup script for this service. Of course, this script is also available in the software package, we just need to copy it to use it. This script is also placed in the Support-files directory, which has a mysql.server file is the service script provided

CP Support-files/mysql.server/etc/init.d/mysql copied to/etc/init.d/directory where the service script was placed

Chkconfig--add MySQL Add this service to the list of services

      Chkconfig on the service is set to boot, the default is 2, 3, 4, 5 These three modes of boot will automatically start
Service MySQL start opens the services

After doing this we can enter the database, but its command path is not in the default path path, but in the/usr/local/mysql/bin/directory, so we need to enter the database every time we have to hit this long string of commands. It's too much trouble.

So let's write the path of this command into the path variable and save the command.

vim/etc/profile.d/mysql.sh

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

source/etc/profile.d/mysql.sh make this configuration file effective in time

Once added, you can use the MySQL command to access the database directly.

7. Security initialization

At this point the MYAQL service has been opened, but it is not safe now. Because now any user can access this database, so we have to set up an administrative user for this database, set access permissions.

The following XXXX user is not required to enter the password:

    

So for security, we're going to set up a safe initialization of the database. This command is self-bringing in the MySQL command pack, so we just have to execute this command to initialize it.

    

    

After you can see the security initialization, the anonymous account is not logged in. Now administrators are free to assign users to manage the database.

The administrator enters the database to view:

    

Of course, the management of the pure character is not so good-looking, so it can also be combined with HTTP and PHP services for graphical management of Web pages, this is the lamp combination. That would be easier to read and easier to manipulate. Of course, we're not going to introduce that much here.

    

MARIADB Binary Package Installation method

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.