Introduction to MySQL and compilation and installation mariadb

Source: Internet
Author: User

A: Introduction to MySQL:

The MySQL database is working in threading mode. is a relational database, there is a strict data model structure, so that when the concurrent read and write volume, you have to extend it, and this way of expansion is very cumbersome.

Since the read operation is cacheable, we can provide a cache server for MySQL.

The program reads the data when the cache server, and then check the MySQL database, so that if the cache has access to content, then you can save access time.

Two: relational data management system RDBMS

Main components in the relational model:

Data scenario: Database

A table, a view (a virtual table, formed by a statement based on a relationship), an index,

stored procedures, stored functions: SQL code Snippets written by the SQL programming interface to allow the user to complete related operations

Triggers: When a statement that modifies a class occurs, a statement that can trigger another or a set of statements occurs is also a code snippet

Cursors: A bit similar to a pointer in the C language

Transactions: Simultaneous execution or not performing acid testing at the same time

User: Implement resource allocation, data access authorization

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/47/7C/wKioL1P7IFLhy52gAACjUoTB_Zc339.jpg "title=" 1.jpg " alt= "Wkiol1p7iflhy52gaacjuotb_zc339.jpg"/>

Connection Manager: Accept user Query statements

The storage engine relies on the transaction manager and the lock manager for data concurrency control

The storage engine can be used as a plug-in switch to determine whether the database supports transaction management.

Recovery manager: When data is crashed, the data is restored to its initial state

Optimizer: Select the optimized path to the storage engine

Three: Data storage mechanism

Data is stored in indexed order, called Index order.

Data is randomly stored on demand called a heap file

Four: MySQL's core components

Connection pooling: Authentication, thread reuse, limit of connections, memory check, cache;

SQL interface: DDL,DML, basic abstraction of relational databases

Parser: Query transformation, object permission check;

Optimizer: Access path, performance-related statistics

Caches and buffers: I/O performance enhancement tools related to the storage engine itself

Storage Engine: Execute operation in SQL statement, MYISAM,INNODB, memory, merge, etc.

Specific components and processes:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/47/7B/wKiom1P7H7uwrK49AAM-APCYzfc435.jpg "title=" 2.jpg " alt= "Wkiom1p7h7uwrk49aam-apcyzfc435.jpg"/>

MySQL Data files:

Files and logs:

Files: Data files and index files

LOG: Transaction log, binary log, query log, slow query log, error log, relay log, where transaction log, binary log is indispensable

To view MySQL server variables or state variables:

The various job properties of MARIADB are defined by their server variables:

SHOW {global| SESSION} Variales [like '];

Many statistics of MARIADB runtime are recorded in the state variables;

SHOW {global| SESSION} STATUS [like '];

Five: Installation method:

RPM package installation, binary common format, source code compilation installation, this introduction source code installation

1. Install CMake (cross-platform compiler)

One of the important features of CMake is its ability to compile independently of the source code (OUT-OF-SOURCE), where compilation can be done in another specified directory rather than in the source directory.

This ensures that the source directory is not affected by any compilation, so multiple compilations can be made on the same source tree, such as for different platforms.

2. For MARIADB system users

Groupadd-r MySQL

Usradd-g mysql-d/mydata/data-r MySQL

Create the/mydata/data directory for the database data directory

Mkidr-pv/mydata/data

Change the database data directory of the genus Master Group to MySQL

chmod Mysql:mysql/mydata/data

3. Execute cmake. -dwith_sphinx_storage_engine=1-dwith_ssl=system-dmysql_datadir=/mydata/data

If the following error occurs:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/47/7C/wKioL1P7IVHx4aVUAADZ2OfSBP4252.jpg "title=" 3.jpg " alt= "Wkiol1p7ivhx4avuaadz2ofsbp4252.jpg"/>

You will need to remove the package and reinstall it, remember to clean it up first

4. Execute make && make install

5. Provide configuration files for mariadb

[[email protected] support-files]# CP my-large.cnf/etc/mysql.cnf # This must end with CNF and not end with Conf

[email protected] support-files]# vim/etc/mysql.cnf

Add Datadir=/mydata/data to it

6. Provide a service script for mariadb to enable it to support service startup

Initialize MARIADB using scripts/mysql_install_db--user=mysql--datadir=/mydata/data under/usr/local/mysql

Note You must use this command under/usr/local/mysql otherwise there will be an error

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/47/7B/wKiom1P7IIDAwjygAAFkjYXp-5I463.jpg "title=" 3.jpg " alt= "Wkiom1p7iidawjygaafkjyxp-5i463.jpg"/>

7. To be able to use Chkconfig control need to use Chkconfig--add mysqld

8. Start the service to verify that you can connect to MySQL

[[Email protected] mariadb-10.0.12]# service mysqld restart shutting down  mysql.  [OK] starting mysql. [OK] [[email protected] mariadb-10.0.12]# mysql  welcome to the mysql monitor. commands end with ; or \ g. your mysql connection id is 4 server version: 5.5.5-10.0.12- mariadb-log source distribution copyright  (c)  2000, 2013, oracle and/ Or its affiliates. all rights reserved. oracle is a registered  trademark of Oracle Corporation and/or its affiliates. Other  names may be trademarks of their respective owners. type  ' help; '  or  ' \h '  for help. Type  ' \c '  to clear the current input  statEment. mysql> 

At this point, our MARIADB compilation installation has been completed.

This article is from the Linux OPS blog, so be sure to keep this source http://germanygu.blog.51cto.com/3574209/1544872

Introduction to MySQL and compilation and 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.