The MySQL database acquaintance

A database Overview

Database data that is stored in the warehouse, the warehouse is only on a computer storage device, and the data is stored in a certain format. People used the data stored in the file cabinet, and now the huge amount of data, no longer apply.

Long-term database is stored in the computer, organized, sharable data collection.

Data in the database according to certain organizational data model, described and storage, has a smaller redundancy, higher data independence and easy scalability, can be shared for various users.

 Database, can be regarded as short electronic file cabinets - electronic file storage premises, users can run the file in the new data, interception, update, or delete operation.

The "Database" lines are stored together in a certain manner, a plurality of users can be shared, with the smallest possible redundancy, the application data set independent of each other.

1. database of advantages:

(1) program stability: this machine Renyiyitai service where the collapse will not affect the data and additional services.

(2) data consistency: all the data are stored together, all the program data operations are unified, it will not appear the phenomenon of inconsistent data

(3) concurrent: concurrent database can be good support, all programs are operating over a network database, while the database itself supports concurrent operation of the network, you do not need to write our own socket

(4) Efficiency: use the database CRUD data efficiency to be higher than many of our own process files

2. What is the data (Data)

Symbol Symbol description of things called data record, describe things can be both digital, it can be text, pictures, images, sounds, language, data from a variety of forms, they can be digitally stored after computer

Describe a thing in the computer, you need to extract the typical characteristics of this thing, the composition of a record, the equivalent of documents in a single line.

3. What is a database management system (DataBase Management System referred to as DBMS)

In the understanding of the concept of Data and DB after, how to organize and store scientific data, how to efficiently obtain and maintain data become critical

This system uses a database management system software ---

如MySQL、Oracle、SQLite、Access、MS SQL Server

mysql is mainly used for large portals, such as Sogou, Sina, its main advantage is the open source because open source database is free, he is now Oracle's products.
oracle is mainly used in banks, railways, airports and so on. The database is powerful, high software costs. Is Oracle's products.
sql server is a Microsoft product, mainly used in medium and large companies, such as Lenovo, Founder and so on.

Database Administrator DBA (Database Administrator).

Relationship between database servers, data management systems, databases, tables and records (focus)

Record: 1 1323456789022 Zhu Ge (information fields composed of a plurality of records, i.e., a line content file)

Table: userinfo, studentinfo, courseinfo (ie, file)

Database: db (ie folder)

Database management systems: as mysql (a software)

Database server: A computer (higher memory requirements)

to sum up:

    Database server: - database management software running

    Database management software: Management - Database

    Database: the folder to organize your files / tables

    Table: the file used to store a multi-line / multiple records

5. development database management technology (understand)

A manual management phase

Before the mid-1950s, computer mainly for scientific computing.

At that time the hardware level: only the external memory tape, card, tape, there is no direct access storage devices such as disk

At that time the software status: no operating system, no software to manage the data, the data is a batch processing mode.

Labor management data has the following characteristics:

1 Data not saved: a computer mainly for scientific computing, using the temporary data, temporary input without saving

Application Management Data 2: application data have to manage application processing logic + requires physical structure, development of a heavy burden of data

3 do not share data: a set of data corresponding to only one program, involving the same data among a plurality of programs, each to be defined, resulting in a lot of redundant data

4 data are not independent: a logical or physical structure of the data changes, corresponding changes must be made to the application, to further increase the burden of development

 

Two stages of file system

The late 1950s to the mid-1960s

Hardware level: With direct access storage devices disk, drum, etc.

Software level: With the operating system and the operating system already has a dedicated data management software, document system; not only have a batch processing mode, but also on-line real-time processing

File system management data has the following advantages:

1 data can be stored for a long: a computer for data processing a large amount, and thus require long-term data storage, for CRUD operations

2 by the file system management data: the file system software, the data is organized into independent data files, by using the file name, press the record access. Implement structural in the record, but no overall structure. And between program and data provided by the file system access conversion method, there is a certain degree of independence between applications and data, the programmer need not be considered excessive physical details.

File system management data has the following disadvantages:

A data sharing is poor, redundancy: a file corresponding to an application, different applications have the same data, each file must be established, can not share the same data, resulting in data redundancy, a waste of space, and the same data is repeated storage, their management, likely to cause data inconsistency

2 difference data independence: Once the logical structure of data is changed, the application must be modified, to modify the definition of the file structure. Change the application, it will also cause changes in the structure of the data file. Therefore, the lack of independence between the data and procedures. Visible, unstructured data continues to be a file system that does not have a collection of elasticity that is isolated between files, memory does not reflect the link between the real world of things.

Phase three Data System

Since the late 1960s, the size of the computer used to manage more and more, more and more widely, the rapid growth of the amount of data, while a variety of applications, covering many languages ​​to share data with each other more strongly binding requirements

Hardware level: With high-capacity disk, hardware architectures fall

Software level: Software prices (development efficiency must be improved, the programmer must be liberated from the Data Management), distributed concept prevailed.

Database system features:

1 structured data (above odboy_stu)

2 data sharing, low redundancy, easy to expand

3 high data independence

4 Data unified management and control by the DBMS

  a: data security protection

  b: Data integrity check

  c: Concurrency Control

  d: Database Recovery

II: Classification Database

The current database can be divided into two broad categories: relational databases and non-relational databases

1.  relational database (RDBMS)

    Explanation: The relational database model is the complex data structures comes down to simple binary relationship (ie, two-dimensional tabular form, not excel, but the form and much like excel), combined with a look at the following figure:

The table looked good chaos ah, but you take a closer look, the establishment of a relationship between these tables, the data shared between the two sides. This is the relationship. Relational databases store data on the inside when similar like this. Yet have a general understanding of relational database ~~~ command operation, which we call SQL, see the following explanation:

Structured Query Language (Structured Query Language) referred SQL (pronunciation: / es kjuː el / "SQL"), is a special-purpose programming language, is a database query and programming language used to access and query data , update and manage a relational database system; but also the database script file name extension.

Structured Query Language is an advanced non-procedural programming language that allows users to work on high-level data structures. It does not require the user to specify the data storage method, the user does not need to know the specific data storage method, the database system is completely different with different underlying structure, the same can be used as a structured query language data input and management interfaces. Structured Query Language statements can be nested, which makes it great flexibility and powerful features.

October 1986, the American National Standards Institute to conduct SQL specification, as the standard language for relational database management systems (ANSI X3. 135-1986), 1987 as an international standard supported by ISO under. However, a variety of database systems prevailing in the course of their practice have made some changes and extensions to SQL coding specification. So, in fact SQL between different database systems can not completely generic with each other .

 

Commonly used relational database:

1.1oracle database

Oracle formerly called SDL, Larry Ellison and the two become arbitrary founded in 1977, they developed a host of high-quality products, a large number of sales in the market. Oracle Corporation is one of the earliest development of relational database vendors, whose products support the widest range of operating system platforms. The current market share of Oracle relational database products of the best.

Oracle Corporation is the world's largest database software company, is also extremely rapid growth in recent years, software and service providers.

Main application areas: the traditional big business, big business, government, finance, securities and so on.

Upgrade: oracle8i, oracle9i, oracle10g, oracle11g, oracle12c

1.2  MySQL

MySQL is widely used in Internet, small medium and large website. Due to small size, high speed, low cost of ownership, open source

1.3 MariaDB database

MAriaDB database management system is a branch of the MySQL database, maintained by the main Kaiyuan community under a GPL license. One reason for developing this MariaDB is: after Oracle's acquisition of MySQL, there are potential risks of MySQL closed source, so the branch of MySQL Community Kaiyuan way to avoid this risk.

MariaDB Maria storage engine based on the transaction, replacing MySQL's MyISAM storage engine, it uses Percona of XtraDB (InnoDB variant) This version also includes PrimeBase XT (PBXT) and Federated X storage engine.

1.4 SQL Server database

Microsoft SQL Server is a large relational database system developed by Microsoft Corporation. SQL Server's features a more comprehensive, efficient and can be used as a database platform or medium-sized units. SQL Server can be tightly integrated with the operating system Winodws, regardless of application or system development speed transaction processing speed, it has been greatly improved, on the Windows platform for a variety of enterprise-wide information management system, whether it is C / S (client / server) architecture, or B / S (browser / server) architecture. SQL Server is a good choice. Drawback is that SQL Server only runs on Windows systems

1.5 Access Database

Access is an entry-level small desktop database, security performance is very general, for personal or small business management only.

 Access database language is not just a database program, the latest version is Office 2007, which is characterized mainly as follows:

(1) improve the management of various database objects, powerful data organization, user management, security checking,

  (2) powerful data processing capabilities, at a working group level in the network environment, the use of multi-user management system, Access developers have traditional XSASE client-server (DBASE, FoxBASE collectively) database system can not be achieved (Ckient / Server ) database security structures and mechanisms of response, Access has many advanced management of large-scale data management system with features.

  (3) can easily generate various data objects, using the stored data to establish the form and report

  (4) as part of the Office suite, may be integrated with Office, connected seamlessly

  (5) to take advantage of Web search and publishing data to achieve connection to the Internet, Access is mainly suitable for small and medium applications, or as a client / server system in the client database.

1.6 Other less common relational database

DB2, PostgreSQL, Informix, Sybase and so on. These relational database gradually weakened achieve common operation and maintenance, especially Internet companies almost did not see.

2. Non-relational databases  

Non-relational database is also known as NoSQL databases, NOSQL purported "Not Olnly SQL". Refers to a non-relational database, rather than the "No SQL" means, therefore, NoSQL generation is not to completely negate a relational database, but as an effective complement to traditional relational databases. NOSQL database may play unimaginable efficiency, and performance at a particular scene. 

With a week of Internet Web2.0 websites, traditional relational databases in dealing web2,0 site, especially for the growing scale of the huge amounts of data, very large scale and high concurrent microblogging, letter, SNS type of pure web2.0 dynamic websites have appeared to be inadequate, exposed a lot of problems difficult to overcome. 

For example: traditional relational database IO bottleneck, performance bottlenecks are difficult to effectively break through, so there is a large number for a specific scene, high performance and ease of use for the purpose of function-specific database product. NOSQL (non-relational) data type is the birth and has been very rapid development in such a scenario.

  High-performance, high concurrency, consistency of data less demanding 
   open source NoSQL systems, such as Facebook's Cassandra, Apache's HBase, has also been widely recognized, Redis, mongb gradually more and more small medium and large companies welcome and sought 

 NOSQL non-relational databases Summary: 
   1, NOSQL not denying the relational database, a relational database but as an important complement to 
   2, NOSQL for high-performance, high-concurrency was born, and ignore the impact of high-performance, high-concurrency features 
   3, NOSQL typical products memcached (pure memory), redis (persistent caching), mongodb (document database)

Non-relational database is divided into the following four:

(1) key (Key-Value) stored in the database      

 Key database is similar to the use of traditional languages ​​in the hash table, you can be added by key, query or delete data, because the use of key primary key access, it will achieve high performance and scalability

 Key (Key-Value) database primarily using a hash table, this table has a specific key and a pointer to the specific data. Key / value model for IT systems has the advantage of simplicity, ease of deployment, high concurrency.

 k1-> Data

 k2-> Data

 Typical products: Memcached, Redis, MemcacheDB, BerkeleyDB 

(2) storage columns (Column-oriedted) Database ======> understood to generally less than Company

This is part of the database is often used to massive data distributed storage, key still exists, but they are characterized by pointing to a number of columns.

 Typical products: Cassandra, HBase

(3) for the document (Document-Oriented) database

Document-oriented database will be stored in the form of the document. Each document data units are self-contained, it is a collection of data items. Each data entry has a name and a value corresponding to the value can be either simple data types such as strings, numbers, dates and the like; may be a complex type, such as an ordered list of objects and relations. The minimum unit of data storage is a document, a table stored in the same document may be different attributes, data may use XML, JSON, or other forms JSONB storage.

Typical products: MorgoDB, CouchDB

(4) Graphics (Graph) database

Common non-relational databases:

2.1 memcached(key-value)

Memcaced is an open source, high performance, having distributed memory object caching system. Through which you can reduce the database load, speed up dynamic web applications, the initial version of the LiveJoumal Brad Fitzpatrick developed in 2003. Currently, there are a lot of users are using it to the schema master site of a large load or high speed access to the site to enhance the response of the host. Note: Memcache is the name of the project, and Memcached is a server-side main program file name.

Cache is generally used to store some of the processes or data object to be accessed, to access objects or data by caching than many on the disk access blocks, the former is a memory, which is a disk, the Memcached cache memory system is a pure , the object or frequently accessed data in the cache memory memcached, these data are cached program is read by way of the API, memcached data inside a gigantic hash table, the data key-value pairs there is a way. Memcached by caching frequently accessed objects or data, thus reducing the pressure frequently read from the database, to improve the response speed of the site, a rapid build faster scalable Web applications.

Official website: http: //memcached.org/

Because pure memcached memory caching software, all data will be lost once the restart, therefore, based on Memcached Sina developed an open source project Memcachedb. Memcached is increased by Berkeley DB special long storage mechanism and the main asynchronous replication mechanism, Memcached with the transaction resilience, persistence and the ability of distributed data replication capabilities, memcached is ideal for ultra-high performance read and write speeds, persistently saved application scenarios, but in recent years gradually replace other durable products such as Redis

Memcached Summary:

  1, key-value database row

  2, pure in-memory database

  3, persistent memcachedb (sina)

2.2  Redis(key-value)

And Memcached Similarly, redis is a key-value type memory system. Supported redis but relatively more stored value type, comprising a string (string), List (list), SET (set) and zset (ordered set) and the like. These data types are supported push / pop, add / remove and taking an intersection, union, and difference operations and a more abundant, and these operations are atomic. In order to ensure efficiency, redis data is cached in memory. The difference is redis will periodically update the data written to disk or to modify the operation of writing additional log files, and to achieve a master-slave (master-slave) synchronized basis.

redis is a key-value high-performance database. redis appears, to a large extent compensate for the lack of such memcached key / value store, it can play a very good complement to relational database in some situations. It provides Python, Ruby, Erlang, PHP client, easy to use.

  Official: http: //www.redis.io/documentation

  redis Features:

  1) support memory caching, this function is equivalent to memcached

  2) support for persistent storage, this function is equivalent to memcachedb, ttserver

  3) database type richer. More than any other key-value database functions

  4) Support from the main cluster, distributed

  5) support for special functions such as queue

  Applications: Cache change the access redis from access memcached

.2.3  MongoDB(Document-oriented)

MongoDB is a product with function between relational databases and non-relational databases, non-relational database functions among the richest and most like a relational database. He supported database structure is very loose, similar to the bjson json format, so you can store more complex data types. Mongodb biggest feature is the query language supported by his very powerful, its syntax is somewhat similar to the object-oriented query language, most of the functionality can be achieved almost single-table queries similar to a relational database, but also support for data indexing.

Features: high performance, easy to deploy, easy to use, very convenient to store data

Main features :

 1. The set is stored for easy storage of data object type

 2. "for the set" (Collenction-Orented) means that the database is stored in a packet data set, is called a set (Collenction) each set has a unique identifying name in the database, and can contain an unlimited number of documents , similar to the concept of a set of relational database (RDBMS) in a table (table) except that it does not need to define any mode (schema)

 3. free mode

Free mode (schema-free) means mongodb the files stored in the database, we do not need to know about any structure definition.

 4. Support dynamic query

 5. Supports fully indexed, contain internal objects

 6. Support inquiry

 7. supports replication and failover

 8. efficient binary data storage, including large objects

 9. Automatic processing debris, to support scalable cloud level

2.4  Cassandra(Column-oriented)

Apache Cassndra is an open source distributed Key-Value storage system. It was originally developed by Facebook, used to store particularly large data. Facebook currently using this system.

main feature:

 1. Distributed

 2. Based on the structuring of the column

 3. High stretchability

 The main features of 4.Cassandra is that it is not a database, but by a bunch of database nodes together form a distributed network service, to Cassandra of a write operation will be replicated to other nodes up for Cassandra read operation. It will be routed to a node above to read.

Cassandir is a hybrid of non-relational databases, like Google's BigTable. Its main function is more abundant than Dynomie (distributed key-value storage systems), Cassandra was originally developed by Facebook, later transformed into an open source project.

2.5 Other less common non-relational databases

HBase、MemcacheDB、BerkeleyDB、Tokyo Cabinet\Tokyo Tyrant(ttserver)

ttserver persistence output, 2 ten million disadvantage storage performance degradation (by the Japanese invention)

three. Early identification MYSQL

1.mysql Introduction

MySQL is a relational database management system , developed by the Swedish company MySQL AB, currently part of  Oracle  's products. MySQL is the most popular relational database management system , one of the WEB applications, MySQL is the best of  the RDBMS  (Relational Database Management System, a relational database management system) applications.

  MySQL is a relational database management systems, relational database stores data in separate tables rather than putting all the data in a large warehouse, thus increasing the speed and improved flexibility.

  MySQL SQL language is used for accessing the database of the most commonly used standardized language. MySQL software uses a dual licensing policy, divided communities and commercial versions, due to their small size, high speed, low cost of ownership, especially open source this feature, the development of small and medium websites have chosen MySQL as the database website.

2 .mysql version of the
  dual-licensed version of: Community Edition (free, functional enough nb a) and commercial (better, more features more powerful, but the charges, VIP, there are after-sales service, will reference and absorption Community Edition Some nb functionality, security and stability are the best, large hundreds of thousands), general NB open source software is licensed double
  each version is divided into four versions in order to publish:
  Alpha version: generally only the company developed in-house use, not publicly, test, self-examination version
  Beta: general development is finished also finished testing version, generally does not appear large performance bug (generally, we do not, Ali, where to use this version, some new features, internal experts can be transferred, but also to evaluate new features of performance)
  RC version: some bug collection, etc. according to Beta testing after conducting a comprehensive version of
  GA version: software released version, there is no particular the demand must use the GA version, some companies pursue new feature uses the Beta version, this is one example.

2.MySQL product lines: (mysql is written in C ++, before the oracle 9i version is written in C language, mainly after java)
  the earliest, mysql accordance 3.x - 4.x - 5.x, etc. development, but in order to increase the competitive advantage of MySQL, as well as improve performance, reduce development and maintenance costs and other reasons, at the same time, more convenient and more accurate business users to choose the right product for their own version of the production environment, the development of MySQL 5.1 after the series version, re-planning for the three product lines.
  Article: 5.0.xx to 5.1.xx series product line introduction
  Article: 5.4.xx to 5.7.xx series product line introduction (mainstream: 5.5 and 5.6)
  Article: 6.0.xx to 7.1.xx product line series introduction
3. MySQL database software named introduction

Mysql-5.7.24.tar.gz the version number to interpret:
 1. The first number is the major version 5, the file format is described. Version 5 Release all have the same file format.
 2. The second number 7 is the release level. Major version number and release level combined together they constitute the issuance serial number.
 3. The third 24 is a data series in this release version number is incremented with each new release. Usually you need to have selected the latest version issued after each update, the last number in the version string is incremented. If you added some new features or minor incompatibilities, version string of the second number is incremented. If the file format changes, the first number is incremented.
 We will add some general release said four versions of the above suffix, beta, alpha, rc version, ga version and so on, we have to give this example is not a suffix, equivalent to GA version

4. MySQL version selected recommendations
 1. Stable: Stable choose open source community version of the GA version
 2 product lines: You can choose 5.1,5.5,5.6, 5.5 and 5.6 mainstream Internet companies, followed by 5.1.
 3. Select the MySQL database GA version for more than 6 months after the GA release.
 A few months no major version of BUG fix the front and rear 4. To select, rather than a large centralized version of the BUG repair of
 5. The best back for a long time did not update the published version.
 6. The development, testing, operation and maintenance, DBA conduct their own local testing, it is best to be consistent and online versions of the worst but also compatible, so as a developer, you have to know which version of the company's database with
 7. As internally developed test database environment, running about 3-6 months.
 8. priority business non-core businesses to adopt new version of the database GA version of the software.
 9. wanted DBA expert advice, or technology is divided into good and to share with the group in using real master spent GA easy to use version of the product.

5.MySQL installation instructions

mysql to provide our open source installation package on each operating system, I made the following two linux, articles windows installed.

mysql linux version installation, start-up and basic configuration:

https://blog.csdn.net/qq_24036403/article/details/91468173

Windows version of mysql installation, start-up and basic configuration:

https://blog.csdn.net/qq_24036403/article/details/84325834

Guess you like

Origin blog.csdn.net/qq_24036403/article/details/93465663