Universal Binary Installation Mariadb

Source: Internet
Author: User

Preparatory work:
Operating system: CentOS 7.4
Install the required software: mariadb-10.2.12-linux-x86_64.tar.gz

I. Preparing the file system for data storage
Creates a new logical volume and mounts it to a specific directory. Here a new 5G logical volume is mounted to the/mydata directory, and the/mydata/data directory is created as a MySQL data directory.

[[email protected] ~]# FDISK/DEV/SDA Welcome to use FDISK (Util-linux 2.23.2). The changes will remain in memory until you decide to write the changes to disk. Think twice before you use the Write command. Command (input m for help): Npartition Type:p Primary (2 primary, 0 extended, 2 free) e extendedselect (default p): P-Partition code (3,4, default Recognition 3): 3 Start Sector (48250880-251658239, default = 48250880): Default 48250880Last sector will be used, + sector or +size{k,m,g} (48250880-251658239, default = 2516582 : +5g partition 3 is set to Linux type, size set to 5 GIB command (input m for help): Wthe partition table has been altered! Calling IOCTL () to re-read partition table. Warning:re-reading the partition table failed with error 16: The device or resource is busy. The kernel still uses the old table. The new table is being used atthe next reboot or after you run Partprobe (8) or KPARTX (8) is synchronizing the disk. [[email protected] ~]# partx-a/dev/sdapartx:/dev/sda:error adding partitions 1-2[[email protected] ~]# part X-a/dev/sdapartx:/dev/sda:error adding partitions 1-3[[email protected] ~]# mkfs-t ext4/dev/sda3mke2fs 1.42.9 ( 28-dec-2013) file System label =os type:linux block Size =4096 (log=2) chunked size =4096 (log=2) stride=0 bLocks, Stripe width=0 blocks327680 inodes, 1310720 blocks65536 blocks (5.00%) reserved for the super User first Data block =0maximum F  Ilesystem blocks=134217728040 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupsuperblock Backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736Allocating Group tables: Completing the inode being written Table: Complete creating Journal (32768 Blocks): Complete writing Superblocks and filesystem accounting Information: complete [[Email protect Ed] ~]# mkdir/mydata[[email protected]t ~]# mount/dev/sda3/mydata[[email protected] ~]# mkdir/mydata/data

Second, the new user to run the program in a safe manner

[[email protected] ~]# groupadd -r mysql[[email protected] ~]# useradd -r -g mysql -s /sbin/nologin -m -d /mydata/data mysqluseradd:警告:此主目录已经存在。不从 skel 目录里向其中复制任何文件。[[email protected] ~]# chown -R mysql:mysql /mydata/data/

Third, install and initialize the mariadb-10.2.12
Download mariadb to local use is mariadb-10.2.12, due to MySQL decompression after the default own installation path is/usr/local path, so unzip the need to extract this directory, and create a link file named MySQL link to this extract directory.

[[email protected] ~]# cd/tmp[[email protected] tmp]# tar XF mariadb-10.2.12-linux-x86_64.tar.gz-c/usr/ Local/[[email protected] tmp]# cd/usr/local/[[email protected] local]# ln-sv mariadb-10.2.12-linux-x86_64 MySQL "MySQL", "mariadb-10.2.12-linux-x86_64" [[email protected] local]# CD mysql/[[email protected] mysql]# chown-r mysql:mysql/*[[email protected] mysql]# scripts/mysql_install_db--user=mysql--datadir=/ Mydata/datainstalling mariadb/mysql system tables in '/mydata/data ' ... OKto start mysqld at boot time has to copysupport-files/mysql.server to the right place for your systemplease Remembe R to SET A PASSWORD for the MariaDB root USER! To does, start the server, then issue the following commands: './bin/mysqladmin '-u root password ' new-password './bin/mys Qladmin '-u root-h localhost.localdomain password ' new-password ' Alternatively you can run: './bin/mysql_secure_ Installation ' which would also give you the option of removing the TEstdatabases and anonymous user created by default. This isstrongly recommended for production servers. See the MariaDB knowledgebase at http://mariadb.com/kb or Themysql manual for more instructions. You can start the MariaDB daemon with:cd './bin/mysqld_safe--datadir= '/mydata/data ' can test the MariaDB daemon W ITH MYSQL-TEST-RUN.PLCD './mysql-test '; Perl mysql-test-run.plplease Report No problems at Http://mariadb.org/jiraThe latest information about MARIADB is Availab Le at http://mariadb.org/. You can find additional information about the MySQL part At:http://dev.mysql.comconsider joining MariaDB ' s strong and VIBR Ant community:https://mariadb.org/get-involved/[[email protected] mysql]# chown-r root./*

Iv. providing a master profile for MARIADB

[[email protected] mysql]# cd support-files/[[email protected] support-files]# mkdir /etc/mysql[[email protected] support-files]# cp my-large.cnf /etc/mysql/my.cnf[[email protected] support-files]# vim /etc/mysql/my.cnf

Add the following 3 lines

datadir = /mydata/dataskip_name_resolve = ONinnodb_file_per_table = ON

V. Provide SYSV service script for MARIADB
Copy the Mysql.server from the Support-files directory to the/ETC/INIT.D directory and rename it to Mysqld, and then add it to the list of services

[[email protected] support-files]# cp mysql.server /etc/init.d/mysqld[[email protected] support-files]# chkconfig --add mysqld

At this point, MySQL is ready to start properly.

[[email protected] support-files]# service mysqld startStarting mysqld (via systemctl):                           [  确定  ]

The following steps are required in order for MySQL installation to conform to the system usage specification and to export its development components to the system
Vi. output mariadb Man manual to find the path to the man command
Edit/etc/man_db.config, add as follows

MANDATORY_MANPATH                       /usr/local/mysql/man

If the system is CENTOS6, edit/etc/man.config Add the following line

MANPATH /usr/local/mysql/man

Vii. output MARIADB header file to System header file path/usr/include

[[email protected] ~]# ln -sv /usr/local/mysql/include /usr/include/mysql"/usr/include/mysql" -> "/usr/local/mysql/include"

Eight, output mariadb library file to the system library to find the path

[[email protected] ~]# echo /usr/local/mysql/lib > /etc/ld.so.conf.d/mysql.conf

To reload the system into the system library

[[email protected] ~]# ldconfig

Ix. Modifying the PATH environment variable
Create a script file under the/ETC/PROFILE.D directory

[[email protected] ~]# vim /etc/profile.d/mysql.sh#!/bin/bashexport PATH=/usr/local/mysql/bin:$PATH

Universal Binary 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.