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

Database introduction and MySQL5.7 version compilation and installation (actual combat! )

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

Share

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

The basic concept data of the database: the symbolic records that describe things are called data (Data), including numbers, text, graphics, images, sound, archival records, etc., and stored in a unified format in the form of "records". Table: by organizing different records together, a "table" is a database used to store specific data: a database is a collection of tables, which is the first generation of interrelated data database system development history stored in a warehouse that stores data in a certain organizational manner.

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

The second generation database in the early 1970s, the second generation database-relational database began to appear. In the early 1980s, IBM's relational database system DB2 came out. As the relational database of the second generation database system, it began to gradually replace the database of hierarchical and network model, and became the dominant database and the mainstream of the industry. Up to now, relational database systems still occupy the main position of database applications. Since the 1980s, a variety of new database systems have emerged to adapt to different fields, such as engineering database, multimedia database, graphic database, intelligent database, distributed database and object-oriented database, especially object-oriented database system. Because of its strong practicability and wide adaptability, it is favored by people in the late 1990s, forming a situation in which a variety of database systems jointly support the application. Of course, in business applications, relational databases still dominate, but some new elements have been added to the mainstream business database systems. For example, the mainstream database introduction of the "relational object" database model supported by Oracle SQL Server (Microsoft products) is simple and easy to use for Windows operating systems, and few people use Oracle (Oracle products) for all major platforms. Operating complex DB2 (IBM products) for all mainstream platforms large, secure, perfect MySQL (Oracle acquisition) free, open source, small size sybase (relational database, Sybase products) large, perfect relational database

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

The relational model is based on the theory of relational algebra. The data structure uses a two-dimensional data table that is easy to understand and can be directly represented by a simple "entity-relation" (Emer R) diagram.

The Emurr diagram contains three elements: entities (data objects), relationships and attributes.

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

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

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

Entity

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

Attribute

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.

Relational database Oracle, MySQLSQLServer, SybaseInformix, accessDB2, FoxPRO relational database application examples 12306 user information system Taobao account information system, Alipay account system mobile, telecom, Unicom mobile phone number information system, billing system bank account system user information system user information system non-relational database introduction

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.

2. 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.

3. The advantages of non-relational database:

The demand for high concurrent read and write of database requires high scalability and high availability for efficient storage of massive data and access to database.

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

5. Column storage (Column-oriented) to store related data in the column family

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

7. Graphic mode. Entities are vertices, relationships are edges, and data is saved as a graph.

8. Memcached is an open source, high-performance caching system with distributed memory objects that stores data in key-value.

Cache data to reduce database pressure and speed up access to speed up dynamic Web application cached contents are stored in memory

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

10. Compared with Memcached, it has the following characteristics:

Support for memory cache, support for persistent data types, more support for clusters, distributed support queues

11. Examples of redis applications

Database front-end cache session sharing when you need to cache more data types than key/value, when the cached data needs to be saved for a long time, the MySQL database is introduced.

MySQL is a popular open source relational database.

Oracle's products

Abide by the GPL agreement, can be used and modified free of charge

Features: excellent performance, stable open source service, no copyright restrictions, low-cost multithreading, multi-user based on Chand S (client / server) architecture. Secure and reliable MySQL Business Edition and Community Edition

MySQL Business Edition is developed and maintained by MySQL AB and can only be used for a fee.

MySQL Community Edition is developed and maintained by MySQL developers and enthusiasts scattered around the world and can be used free of charge.

The difference between the two: the commercial version is more stringent in organization, management and testing, and the commercial version is more stable. If the commercial version does not comply with GPL, you can get 24-hour service, such as fault maintenance and patching, and other MySQL product camps.

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

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

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

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

MySQL5.7 compiler installation 1. Install the environment package required for compiling mysql [root@localhost ~] # yum-y install\ > ncurses\ > ncurses-devel\ > bison\ > cmake\ > gcc\ > gcc-c++.// omits the installation process 2. Add a mysql user [root@localhost ~] # useradd-s / sbin/nologin mysql [root@localhost ~] # 3. Extract the mysql source code package to the "/ opt/" directory [root@localhost ~] # mkdir / mnt/tools [root@localhost ~] # mount.cifs / / 192.168.100.50/tools / mnt/tools/Password for root@//192.168.100.50/tools: [root@localhost ~] # cd / mnt/tools/MySQL/ [root@localhost MySQL] # lsboost_1_59_0.tar.gz mysql-5.7.17.tar.gz [root@localhost MySQL ] # tar zxvf mysql-5.7.17.tar.gz-C / opt/.// omit decompression process [root@localhost MySQL] # tar zxvf boost_1_59_0.tar.gz-C / usr/local/.// omit decompression process [root@localhost MySQL] # 4. Rename the "boost_1_59_0" directory to "boost" [root@localhost MySQL] # cd / usr/local/ [root@localhost local] # mv boost_1_59_0/ boost [root@localhost local] # lsbin boost etc games include lib lib64 libexec sbin share src [root@localhost local] # 5. Configure mysql service [root@localhost local] # cd / opt/mysql-5.7.17/ [root@localhost mysql-5.7.17] # cmake\ >-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ / / installation path >-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\ / / define sock file connection database file >-DSYSCONFDIR=/etc\ / / configuration file directory >-DSYSTEMD_PID_DIR=/ Usr/local/mysql\ / / PID file directory >-DDEFAULT_CHARSET=utf8\ / / specified character set Utf8 supports Chinese characters >-DDEFAULT_COLLATION=utf8_general_ci\ specify character set default >-DWITH_INNOBASE_STORAGE_ENGINE=1\ Storage engine >-DWITH_ARCHIVE_STORAGE_ENGINE=1\ >-DWITH_BLACKHOLE_STORAGE_ENGINE=1\ >-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\ >-DMYSQL_DATADIR=/usr/local/mysql/data\ / / Database data file directory >-DWITH_BOOST=/usr/local/boost\ / / underlying operation Row library >-DWITH_SYSTEMD=1 / / master-slave parameter 6. Compile and install the MySQL service [root@localhost mysql-5.7.17] # make & & make install.// omits the compilation process [root@localhost mysql-5.7.17] # 7. Change the database directory owner, group [root@localhost mysql-5.7.17] # chown-R mysql.mysql / usr/local/mysql/ [root@localhost mysql-5.7.17] # 8. Modify the configuration file [root@localhost mysql-5.7.17] # vim / etc/my.cnf [client] / / client port = 3306default-character-set=utf8socket = / usr/local/mysql/mysql.sock [mysql] / / client port = 3306default-character-set=utf8socket = / usr/local/mysql/mysql.sock [mysqld] / / Server user = mysql/ / user basedir = / usr/local/mysql/ / set mysql installation directory datadir = / usr/local/mysql/data / / set mysql database data storage directory port = 3306 / / set port 3306 character_set_server=utf8 / / Chinese character set pid-file = / usr/local/mysql/ Mysqld.pid / / pid file path socket = / usr/local/mysql/mysql.sock / / sock file path server-id = 1 / / master-slave parameter sql_mode=NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES// support module [root@localhost mysql-5.7.17] # chown mysql:mysql / etc/my.cnf / / modify the file belongs to the master group [root@localhost mysql-5.7.17] # 9. Add mysql related commands to local environment configuration [root@localhost mysql-5.7.17] # echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' > > / etc/profile// write MySQL to local environment configuration [root@localhost mysql-5.7.17] # echo' export PATH' > > / etc/profile// set global environment configuration [root@localhost mysql-5.7.17] # source / Etc/profile / / reload the configuration file [root@localhost mysql-5.7.17] # 10. Initialize the database [root@localhost mysql-5.7.17] # cd / usr/local/mysql/ [root@localhost mysql] # bin/mysqld\ >-- initialize-insecure\ / / initialize >-- user=mysql\ / / user >-- basedir=/usr/local/mysql\ / / installation directory >-- datadir=/usr/local/mysql/data / / database data file directory 11. Copy the MySQL service configuration file to / usr/lib/systemd/system/ to facilitate the use of systemctl management [root@localhost mysql] # cp usr/lib/systemd/system/mysqld.service / lib/systemd/system/// replication [root@localhost mysql] # systemctl daemon-reload / / reload [root@localhost mysql] # systemctl start mysqld.service / / start the service [root@localhost mysql] # netstat-ntap | grep 3306 / / View tcp3306 port tcp6 0:: 3306:: * LISTEN 78684/mysqld [root@localhost mysql] # systemctl enable mysqld.service / / set self-boot Created symlink from / etc/systemd/system/multi-user.target.wants/mysqld.service to / usr/lib/systemd/system/mysqld.service. [root@localhost mysql] # 12. Configure the MySQL password [root@localhost mysql] # mysqladmin-u root-p passwordEnter password: New password: Confirm new password: Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety. [root@localhost mysql] # 13. Try logging in to the MySQL database [root@localhost mysql] # mysql-u root-pEnter password: Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 4Server version: 5.7.17 Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c' to clear the current input statement.mysql > grant all privileges on *. * to 'root'@'%' identified by' abc123' with grant option / / to enable all terminals to remotely log in to Query OK, 0 rows affected, 1 warning (0.00 sec) mysql > quit / / exit Bye [root@localhost mysql] # [root@localhost mysql] # systemctl stop firewalld.service / / turn off the firewall [root@localhost mysql] # setenforce 0 / / disable the enhanced security function [root@localhost mysql] # 14. Log in remotely with Navicat tool

15. Enter the database to view all database [root@localhost mysql] # mysql-uroot-pEnter password: Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 6Server version: 5.7.17 Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c' to clear the current input statement.mysql > show databases; / / View database +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sys | +-+ 4 rows in set (0.00 sec) mysql >

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