Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The first experience of MySQL database (including MySQL database 5.7.17 manual compilation

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The first experience of MySQL Database

Ram: random access to memory, loss of data memory due to power outage

Rom: read-only access to memory without data loss

Manage the stored data, add, delete, modify and query the data, migrate the data, and ensure the privacy of the data

1. The basic concept of database

two。 The development of database

3. Introduction to mainstream databases

4. Compile and install mysql

5. Manipulate mysql

The basic conceptual data of the database:

1. The symbolic record that describes things is called Data.

two。 Including numbers, text, graphics, images, sound, archival records, etc.

3. To store in the form of "record" in a unified format.

Table:

1. By organizing different records together, a "table" is formed.

two。 Is used to store specific data.

Database:

1. A database is a collection of tables and a warehouse for storing data.

two。 Interrelated data stored in a certain organizational manner

The first generation database in the history of database system development

Since the 1960s, the first-generation database system has come out. They are the database systems of hierarchical model and mesh model, which provide a strong support for unified management and sharing of data.

Second generation database:

1. In the early 1970s, the second generation of databases-relational databases began to appear.

2. In the early 1980s, the relational database system DB2 of IBM Company came out. As the relational database of the second generation database system, it began to replace the hierarchical and mesh model database gradually, and became the dominant database and the mainstream of the industry. Up to now, relational database system still occupies the main position of database application.

The third generation database:

1. Since the 1980s, a variety of new database systems adapted to different fields have been emerging, such as engineering database, multimedia database, graphic database, intelligent database, distributed database and object-oriented database, especially the object-oriented database system, which is favored by people because of its strong practicability and wide adaptability.

2. In the late 1990s, a variety of database systems supported the application together. Of course, in business applications, relational databases still dominate, but some new elements have been added to mainstream business database systems. For example, the "relational-object" database model supported by Oracle

Relational databases: data integer, floating point, character, string (fixed length, variable length), Boolean

Non-relational databases: objects (pictures, videos)

SQL Server (Microsoft products) is introduced in today's mainstream database.

1. For Windows operating system (client)

two。 Simple and easy to use

Oracle (Oracle products)

1. For all mainstream platforms

two。 Safe, perfect and complex to operate

DB2 (IBM products)

1. For all mainstream platforms

two。 Large, safe and perfect

MySQL (acquired by Oracle)

1. Free, open source, small size

Relation database

1. Relational database system is a database system based on relational model, and its basic concept comes from relational model.

two。 The relational model is based on the theory of relational algebra. The data structure uses an easy-to-understand two-dimensional data table, which can be directly represented by a simple "entity-relation" (Emurr) diagram.

The 3.E-R diagram contains three elements: entities (data objects), relationships and attributes.

Entity:

Also known as an example, corresponding to "events" or "things" that can be distinguished from other objects in the real world, such as bank customers, bank accounts, etc.

Attributes:

A characteristic of an entity that an entity can have more than one attribute. For example, each entity in the "bank customer" entity set has attributes such as name, address, phone number, etc.

Contact:

The correspondence between entity sets is called a relationship, also known as a relationship. For example, there is a "savings" relationship between bank customers and bank accounts.

The collection of all entities and their relationships forms a relational database

1. The storage structure of relational database is a two-dimensional table, and the data reflecting things and their relationships are saved in tabular form.

two。 In each two-dimensional table, each row is called a record to describe the information of an object; each column is called a field, which is used to describe an attribute of the object.

Introduction of non-relational database 1. Non-relational database, also known as NoSQL (Not Only SQL), stores data without a relational model and does not require a fixed table format. As a supplement to relational database, non-relational database plays an important role in high efficiency and high performance in the increasingly rapid development of the website era. Advantages of non-relational databases:

Requirements for High concurrent read and write in ① Database

Efficient Storage and access of massive data by ② (big data)

Requirements for high scalability and high availability of ③ databases (can be clustered to ensure high availability and high reliability)

Object contains: attributes, behavior, storage mode of non-relational database

1. Key-value mode (key-value), which stores, deletes and modifies data based on keys

two。 Column storage (Column-oriented) to store related data in a column family

3. In the way of documents, the database consists of a series of data items, each with a name and a corresponding value

4. Graphically, entities are vertices, relationships are edges, and data is saved as a graphic

The non-relational database product Memcached is an open source, high-performance, caching system with distributed memory objects that stores data in key-value.

1. Cache data to reduce database pressure and speed up access

two。 Accelerate dynamic Web application

3. The contents of the cache are saved in memory

Redis also stores data in key-value, which is also stored in memory, but writes the data to disk on a regular basis.

1. Compared with Memcached, it has the following characteristics

① supports memory caching

② supports persistence

More ③ data types

④ supports clustering and distributed

⑤ support queues

Examples of redis applications:

1. Database front-end cache

2.session sharing

3. When you need to cache more data types than key/value

4. When cached data needs to be saved for a long time

MySQL Database introduction 1.MySQL is a popular open source relational database 2.Oracle product 3. Comply with the GPL agreement, can be used and modified free of charge. Characteristics

① has excellent performance and stable service.

② open source, no copyright restrictions, low cost

③ multi-thread and multi-user

④ is based on Candace S (client / server) architecture

⑤ is safe and reliable.

MySQL Business Edition and Community 1.MySQL Business Edition are developed and maintained by MySQL AB. You need to pay to use 2.MySQL Community Edition, which is developed and maintained by MySQL developers and enthusiasts scattered around the world. The difference between the two:

① Commercial Edition has stricter organizational management and testing links and better stability.

② Business Edition does not comply with GPL

③ Business Edition is available 24 hours a day, such as fault maintenance and patching.

MySQL product camp

1. Camp one: camp 5.0-5.1, which can be said to be a continuation of early products.

two。 Camp 2: camp 5. 4-5. 7, better integrating storage engines run by MySQL AB, the community, and third-party companies to improve performance

3. The third camp: camp 6. 0-7. 1, which is the MySQL Cluster version, developed to meet the database needs of the new era cluster

4.MySQL download website: http://www.dev.mysql.com/downloads

Demo:MySQL Database 5.7.17 manually compile and install [root@localhost ~] # yum-y install\ ncurses\ ncurses-devel\ bison\ cmake [root@localhost ~] # useradd-s / sbin/nologin mysql [root@localhost ~] # mkdir / aaa [root@localhost ~] # mount.cifs / / 192.168.0.105/rpm / aaaPassword for root@//192.168.0.105/rpm: [root@localhost ~] # cd / aaa [root@localhost aaa] # lsapr -1.6.2.tar.gz lf.jpgapr-util-1.6.0.tar.gz mysql-5.6.26.tar.gzawstats-7.6.tar.gz mysql-5.7.17.tar.gzboost_1_59_0.tar.gz mysql-boost-5.7.20.tar.gzcronolog-1.6.2-14.el7.x86_64 .rpm nginx-1.12.2.tar.gzDiscuz_X3.4_SC_UTF8.zip php-7.1.10.tar.bz2error.png php-7.1.20.tar.gzextundelete-0.2.4.tar.bz2 TChttpd-2.4.29.tar.bz2 wh.jpegjohn-1.8.0.tar.gz yy.pngjqwh. Jpg [root@localhost aaa] # tar zxvf mysql-5.7.17.tar.gz-C / opt/ [root@localhost aaa] # tar zxvf boost_1_59_0.tar.gz-C / usr/local/ [root@localhost aaa] # cd / usr/local/ [root@localhost local] # lsbin etc include lib64 sbin srcboost_1_59_0 games lib libexec share [root@localhost local] # mv boost_1_59_0/ boost [root@localhost Local] # lsbin etc include lib64 sbin srcboost games lib libexec share [root@localhost local] # cd / opt/mysql-5.7.17/ [root@localhost mysql-5.7.17] # lsBUILD extra mysys stringsclient include mysys_ssl support-filescmake INSTALL packaging testclientsCMakeLists.txt libbinlogevents plugin Unittestcmd-line-utils libbinlogstandalone rapid VERSIONconfig.h.cmake libevent README vioconfigure.cmake libmysql regex winCOPYING libmysqld scripts zlibdbug libservices sqlDocs man sql-commonDoxyfile-perfschema mysql-test storage [root@localhost mysql-5.7. 17] # yum install gcc gcc-c++-y [root@localhost mysql-5.7.17] # cmake\-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\-DSYSCONFDIR=/etc\-DSYSTEMD_PID_DIR=/usr/local/mysql\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_ARCHIVE_STORAGE_ENGINE=1\-DWITH_BLACKHOLE_STORAGE_ENGINE=1\-DWITH_PERFSCHEMA_ STORAGE_ENGINE=1\-DMYSQL_DATADIR=/usr/local/mysql/data\-DWITH_BOOST=/usr/local/boost\-DWITH_SYSTEMD= 1 [root @ localhost mysql-5.7.17] # make & & make install [root@localhost mysql-5.7.17] # chown-R mysql/ usr/local/mysql/ [root@localhost mysql-5.7.17] # vim / etc/my.cnf# delete all lines first by 100dd Then insert the following content [client] port = 3306default-character-set=utf8socket = / usr/local/mysql/ mysql.socks [MySQL] port = 3306default-character-set=utf8socket = / usr/local/mysql/ mysql.socks [mysqld] user = mysqlbasedir = / usr/local/mysqldatadir = / usr/local/mysql/dataport = 3306character_set_server=utf8pid-file = / usr/local/mysql/mysqld.pidsocket = / usr/local/mysql/mysql.sockserver-id = 1sqlcards modemarked NONGENGENGINESUBSTITUTIONAccept STRICTICTRANSmatching TABLES Press Esc to exit insert mode after NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES# modification Enter: wq save exit [root@localhost mysql-5.7.17] # chown mysql.mysql / etc/my.cnf [root@localhost mysql-5.7.17] # echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' > > / etc/profile [root@localhost mysql-5.7.17] # echo' export PATH' > > / etc/profile [root@localhost mysql-5.7.17] # source / usr/local/mysql [root@localhost mysql -5.7.17] # cd / usr/local/mysql/ [root@localhost mysql] # bin/mysqld\-- initialize-insecure-- user=mysql-basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data [root@localhost mysql] # cp / usr/local/mysql/usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system/ [root@localhost mysql] # systemctl daemon-reload [root@localhost mysql] # systemctl start mysqld.service [root@localhost mysql] # Netstat-ntap | grep 3306tcp6 00: 3306:: * LISTEN 3029/mysqld [root@localhost mysql] # systemctl enable mysqld [root@localhost mysql] # mysqladmin-u root-p password "abc123" # specify the new password Enter password: # empty here directly enter [root@localhost mysql] # mysql-u root-p Enter password: # enter the previously set password abc123. Omitting multiple lines mysql > grant all privileges on *. * to 'root'@'%' identified by' abc123' with grant option;# can log in to the database at this time, and you can directly grant permissions Query OK, 0 rows affected, 1 warning (0.00 sec)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report