Database Introduction -1mysql Installation

Source: Internet
Author: User
Tags memcached mkdir mysql version percona server ssl connection

1th. Database introduction and MySQL Installation

1.1 Introduction to the database

The database, in short, can be seen as electronic file cabinets-the place where electronic files are stored, the user may run new, intercept, update, delete operations on the data in the file.

A "database" is a collection of data that is stored in a certain way, shared by multiple users, with the smallest possible redundancy, and independent of the application.

1.1.1 What is data

Data refers to the recording of objective events and can be identified symbols, is the nature of the objective things, state and the relationship between the physical symbols or the combination of these physical symbols. It is a recognizable, abstract symbol.

1.1.2 Database Management System

Non-relational database

NoSQL: Non-relational database (not only SQL)

It is not a negative relational database, it is the complement of relational database. Want to be the eldest, learn to be a dick first.

relational database

Characteristics of relational database

1.1.3 NoSQL Features Overview

L is not a negative relational database, but as a supplement, there is now a partial substitution trend.

L Focus on high performance, high concurrency, flexibility, neglect and the above unrelated functions.

L now also improve security and use features.

L Typical Products: Redis (persistent cache, two half-day), MongoDB (the most close to relational data NoSQL), Memcached.

L Management does not apply to SQL management, but instead uses some special APIs or data interfaces.

1.1.4 NoSQL classification, features, typical products

Key value (KV) storage: Memcached, Redis

Columnstore (column-oriented): HBASE (Sina, 360), Cassandra (200 server clusters)

Document Database (document-oriented): MongoDB (NoSQL closest to relational database)

Graphics Storage (graph): neo4j

Data Source: https://db-engines.com/en/ranking

1.2 Database related Products 1.2.1 Oracle Company product Introduction

Oracle Database Version Introduction

7--8I--9I--10G-11G--12C--18C (?)

Oracle of market Applications

A) market share first, declining trend

b) Market space, traditional enterprise

c) Traditional enterprises are also in the Internet

MySQL Database Version Introduction

5.0--5.1--5.5--5.6--5.7--8.0

MySQL of market Applications

A) medium and large-scale internet companies

b) Market space: First in the Internet area

c) Obvious trends

d) Homologous products: MariaDB, perconadb

1.2.2 Other Company Products

Microsoft: SQL Server

Microsoft and sysbase co-developed products, and later developed their own, Windows platform 3, 4-wire small companies, traditional industries in use

IBM : DB2 Database

Small market share

Currently only: state-owned banks (people, Bank of China, ICBC, etc.), China Mobile application.

The following three are widely used in large-scale internet companies

PostgreSQL MongoDB Redis
1.3 MySQL Introduction 1.3.1 MySQL database history
1 1979, Report Tool Unireg appears. 2 1985, led by David Axmark of Sweden, founded a company (AB predecessor), Iasm engine appeared. 3 1990, provides SQL support. 4 1999-2000, MySQL AB Company was founded, and published source code, open source. 5 April 2000 BDB engine appeared, which supported the transaction. 6 January 16, 2008, Sun (Solar micro System) formally acquired MySQL. 7 April 20, 2009, Oracle announced the acquisition of Sun Computer Company with a total of $9.50, $7.4 billion, and MySQL transferred to Oracle. 8 June 18, 2013, Oracle modified the MySQL license agreement to remove the GPL. But then there was a message that it was a bug.
1.3.2 MySQL Features Introduction

Open source, Community edition free, simple, easy to use, reliable, stable, secure, community active

Introduction to the 1.3.3 MySQL product line

MySQL product line (main line)

3.26--5.2 version

– Authentic Offspring

–CENTOS5, 6 default version 5.1

The default is mariadb in –centos7

5.4--5.7 , 8.0 version

– Learn from the community's good contributions to further develop the version

– Mainstream version: 5.5 5.6 5.7

MySQL Cluster 6.0 Version & more High

– Similar to Oracle RAC, hardware requirements are high.

– Generally, no one is using the major websites

MySQL product line ( derivative products)

The derived versions are drizzle, MariaDB, Percona Server, Ourdelta, and so on.

1.3.4 Enterprise Production Scenarios Select MySQL Database recommendations:
1) Stable version: Select Open Source Community Edition of stable version of GA version 2) product line: You can choose 5.1 or 5.5 Internet company mainstream 5.5, followed by 5.1 and 5.6 3) Select the GA version of MySQL database for more than 6 months after release. 4) To choose a version that does not have a large bug fix for a few months or so, rather than a large number of fixed bugs in the centralized version 5) It is best to go back for a long time without updating the release of version 6) to consider whether the version that the developer developer uses is compatible with your chosen version 7) as an in-house developer development test Run about 3-6 months of events 8) Priority Enterprise Non-core business using a new version of the database GA version of the Software 9) to the DBA Master Consult, or in the technical atmosphere of a good group and everyone to communicate, using the real masters used by the use of GA version of the product 10) If there is no important functional bugs or performance bottlenecks, You can start thinking back-end database software as any of the task Data services
1.4 MySQL Database Installation 1.4.1 System Environment description
[Email protected] ~]# cat/etc/redhat-release CentOS release 6.9 (Final) [[email protected] ~]# uname-r2.6.32-696.el6.x86 _64[[email protected] ~]#/etc/init.d/iptables Statusiptables:firewall is not running. [Email protected] ~]# getenforce disabled[[email protected] ~]# hostname-I  10.0.0.52 172.16.1.52
1.4.2 MySQL Compilation installation

Install dependent packages

Yum  Install-  y  ncurses-devel libaio-devel

Installing the CMake Compilation tool

CMake

Custom features: Storage engine, character set, compression, etc.

Custom installation location, data storage location, file location (socket)

Yum Install Cmake-y

Create a MySQL Admin user

Useradd-s/sbin/nologin-m mysql-u1000id MySQL

Download MySQL software package, unzip

mkdir  -p/server/tools cd/server/toolswget-q Http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36.tar.gztar XF Mysql-5.6.36.tar.gz

Note: This is using the Sohu image source for download (software version 5.6.36)

Official Download Method Reference: Http://www.cnblogs.com/clsn/p/8025324.html#_label4

Enter the query directory, use CMake to compile, install, create a soft connection, the process time is longer.

CD Mysql-5.6.36cmake. -dcmake_install_prefix=/application/mysql-5.6.36-dmysql_datadir=/application/mysql-5.6.36/data-dmysql_unix_ Addr=/application/mysql-5.6.36/tmp/mysql.sock-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dwith_ Extra_charsets=all-dwith_innobase_storage_engine=1-dwith_federated_storage_engine=1-dwith_blackhole_storage_ Engine=1-dwithout_example_storage_engine=1-dwith_zlib=bundled-dwith_ssl=bundled-denabled_local_infile=1-dwith_ Embedded_server=1-denable_downloads=1-dwith_debug=0make && make Installln-s/application/mysql-5.6.36// Application/mysql
1.4.3 The operation of the database after installation

Copying a configuration file

\CP  /application/mysql/support-files/my-default.cnf/etc/my.cnf

The compiled MySQL can temporarily not need to set the configuration file.

Note: If the previous operating system has been installed in the RPM format of MySQL, the system may have left the/etc/my.cnf file, we need to remove it

Initializing the database

/application/mysql/scripts/mysql_install_db--basedir=/application/mysql/--datadir=/application/mysql/data-- User=mysql

  prevent error: database startup will prompt, unable to find Xx/tmp/mysql.sock, because 5.6. version 36 does not automatically create the TMP directory, we need to create it manually.

Mkdir/application/mysql/tmp

Modify the owner of the program directory, belong to the group

Chown-r mysql.mysql/application/mysql/

Copy the startup script and modify the permissions

CP Support-files/mysql.server/etc/init.d/mysqldchmod 700/ETC/INIT.D/MYSQLD

Add environment variables, use MySQL Command

Echo ' path=/application/mysql/bin/: $PATH ' >>/etc/profiletail-1/etc/profilesource/etc/profileecho $PATHmysql
1.4.4 Database Security Settings

Set the root user password

mysqladmin-u root password ' 123456 ' mysql-uroot-p123456

Optimize the database (clean up users and useless databases)

Select User,host from Mysql.user;drop user ' @ ' db02 ';d rop user ' @ ' localhost ';d rop user ' root ' @ ' db02 ';d rop user ' root ': : 1 '; Select User,host from mysql.user;drop database test;show databases;
1.5 MySQL version 5.7 installation instructions

Host system Environment Description

[Email protected] ~]# Cat/etc/redhat-releasecentos release 6.9 (Final) [[email protected] ~]# uname-r2.6.32-696.el6.x86 _64[[email protected] ~]# getenforcedisabled[[email protected] ~]#/etc/init.d/iptables Statusiptables:firewall is not r Unning. [Email protected] ~]# hostname-i10.0.0.153 172.16.1.153

Get the software (installed in binary package mode)

Mkdir-p/server/toolscd/server/toolswget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86 _64.tar.gz

Extract

Tar XF mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

To move software to the program directory, create a soft connection

Mkdir-p/APPLICATION/MV mysql-5.7.17-linux-glibc2.5-x86_64/application/mysql-5.7.17ln-s/application/mysql-5.7.17 /application/mysql

Add a MySQL user and authorize

Useradd-m-s/sbin/nologin-  u mysqlchown-r mysql.mysql/application/mysql-5.7.17

Initializing the database

/application/mysql-5.7.17/bin/mysqld--initialize--user=mysql--basedir=/application/mysql-5.7.17--datadir=/ Application/mysql-5.7.17/data

Note the last line of output root password when initializing

2017-12-13t08:40:31.760309z 1 [Note] A temporary password is generated for [email protected]:) *1e7=fyd&>i

Copying configuration files and startup files

\CP/APPLICATION/MYSQL-5.7.17/SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CN\CP \application/mysql-5.7.17/support-files/ Mysql.server/etc/init.d/mysqld

# Modify startup file Contents (config directory)

You can omit this step by installing the program into/usr/local/

Sed ' s#/usr/local#/application#g '/application/mysql-5.7.17/bin/mysqld_safe/etc/init.d/mysqld-i

Start MySQL

[Email protected] tools]#/etc/init.d/mysqld start starting mysql.logging to '/application/mysql/data/db13.err '. success! [Email protected] tools]#/etc/init.d/mysqld status success! MySQL Running (1509)

Adding environment variables

Echo ' path=/application/mysql/bin/: $PATH ' >>/etc/profiletail-1/etc/profilesource/etc/profileecho $PATH

Modify MySQL Password

[[email protected] tools]# mysqladmin-uroot-p password 123456Enter password: "Input password generated at initialization" mysqladmin: [Warning] Using A Password on the command line interface can is insecure. Warning:since password is sent to server in plain text, use SSL connection to ensure password safety.

Introduction to Database -1mysql 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.