Week7 Day1 identifies the database for the first time

1. The origin of database management software

Based on what we learned earlier, the data will be permanently stored in the document. There is no doubt that the file can only exist on a specific device.

If we ignore the efficiency of data that is directly based on files, and assume that all components of the software are running on the same machine, data access data will not be an issue.

Unfortunately, all of these assumptions are outrageous. The above assumptions have the following problems. Essence Essence Essence Essence

  1. Not all software components can run on the same machine
    Because after this machine hangs, it means that all programs collapse, and the execution efficiency of the program depends on the hardware you carry. The performance of the vertical machine is limited.
    In this way, we can improve the overall performance of our system through horizontal scaling, which requires us to distribute each component of the software to multiple machines.
  2. Data security issue
    According to Description 1, we distribute each component of the software to each machine, but it is necessary to know that each component is still intact. The value of all components must be used. However, only the components on each device can manage device files, resulting in inconsistent data.
    So we thoughtSeparate data from applications: store files on a device, and then access multiple devices across the network to access the files on that device (port with a socket), that is, share files on this device, share means competition, which means competition means competition. The data will be insecure and must be locked. Essence of the essence
  3. Synchronized
    According to description 2, we have to write a socket server to manage files on the device (database server), and then write a socket client to perform the following functions:
    1. Remote connection (support synchronization)
    2. Open the file
    3. Reading and Writing (Prohibition)
    4. Close the file

sum up:

Before writing any program, we need to write a program based on network operation (server and Socket client program) based on network operation. The origin of the management software, but MySQL not only solves the problem of data exchange, but also solves a series of problems such as query efficiency and security. In short, the programmer is free from data management and focus on writing the logic of his program.

2. Database overview

2.1 What kind of data

The code for writing a description of things is called data. Description characters can be numbers, text, pictures, images, sounds, languages, etc. through digitization.

To describe something on a computer, you need to extract the typical properties of that thing to form a record equivalent to a content line in a file, like so:

egon,male,18,1999,Шандун,Информатика,2017,oldboy

Simple notation doesn’t make any sense. If we match a comma as the separator, the value of each field is selected in turn, which is equivalent to specifying the table header.

name,sex,age,birth,born_addr,major,entrance_time,school 
egon,male,18,1999,Шандун,Информатика,2017,oldboy 

2.2 What is a database called a DB database

A database is a warehouse that stores data, but this warehouse is stored on a computer storage device and the data is stored in a specific format. In the past, people were kept in a filing cabinet. The data volume is currently huge and this is no longer applicable.

A database is long data that is stored on a computer, organized and shared.

The data in the database is organized, described, and stored according to a defined data model. They have little redundancy, high data independence, easy scalability, and can be ported to different users.

2.3 What is Database Database Management System abbreviated as DBMS

After understanding the concepts of data and database, how to prevent and store data from a scientific point of view, and how efficient and maintainable the data is the key, he uses a database software management system. Such as MySQL, Oracle, SQLite, Access and MS SQL Server.

MySQL is mainly used for large portals such as Sogou, Sina, etc. Its main advantage is open source, because the open source database is free, it is an Oracle product.

Oracle is mainly used for banks, railways, airports, etc. The database has powerful features and high software costs. It is also an Oracle product.

SQL Server is a Microsoft product, mainly used by large and medium enterprises such as Lenovo and Founder.

2.4 The relationship between the database server, the database management system, the database, the tables, and the records(The key to understanding!!!)

Entry: 1 Liu Haolong 324245234 22 (multi-shelf information constitutes an entry, that is, a content line in the file)

Surface: Student, Sholl, class_list (any file)

Database: oldboy_stu (any folder)

Database management system: for example, MySQL (program)

database server: Computer (high memory requirements)

sum up:

Database server: Run the database management software
Database management software: database management
Database: The folder used to organize the file/table
Table: The file used to store multiple rows/multiple records

2.5 Database management technology development (understanding)

  1. artificial control stage
    Until the mid-1950s, computers were mainly used for scientific computing.
    At that time, hardware levels: only storage devices, such as paper belts, cards, and tapes, and no direct access to disks. The state of the program at that time: a program with no operating systems and no control data. The method of processing data is processing. Artificial control data has the following characteristics:
    1 data is not stored: computers are mainly used for scientific computing, temporary use of data, temporary input, not storage
    2 Application data: The application itself must manage the data. The application is necessary to process the logic + physical data structure. The development burden is too heavy
    3 Data is not transferred: The data set is compatible with only one program. When multiple programs include the same data, they must be specified, resulting in a large amount of duplicate data.
    4 The data is not independent: After changing the logical structure or physical structure of the data, the application must be modified accordingly, and the development burden must be further increased

  2. file system stage
    Late fifties to mid sixties
    Hardware level: with direct access disc and magnetic rollers. Software level: using the operating system, and the operating system has a dedicated data management software, that is, the file system; The processing method not only has batch processing, but also can process in real time. File system management data has the following advantages:
    1 Data can be stored for a long time: a large amount of computer is used to process data, so data needs to be stored for a long time, and additional deletion work is done,
    2 Operated by file system management data: file system software, organize data into relatively independent data files, and use file names to access records. The log structure has been implemented, but overall there is no structure. The transfer must move from the file system between the program and the data. This is a certain independence between the application and the data. The programmer may not have to take a lot of physical data into account.
    File system management data has the following disadvantages:
    1 Poor connection, high duplication: The file matches the application. When different applications have the same data, they must also install their own files. The same data cannot be exchanged.
    2 Poor data independence: After changing the logical data structure, the application must be changed and the file structure definition changed. Changing the application will also change the file’s data structure. Hence the lack of independence between data and software. It can be seen that the file system is still an unstructured data set that is not flexible, that is, isolated between files, and cannot reflect the memory connection between real worlds.

  3. stage of the data system
    Since the late 1960s, the size of control computers has become larger, applications have become more widespread, the amount of data has grown exponentially, and different applications have been transmitted to each other in different languages.
    Hardware level: With a larger disk, the hardware architecture is reduced.
    Software level: software prices increase (development efficiency must be improved, programmers must be freed from data management) and distributed concepts prevail.
    Database system features:
    1 Structured data (ODBOY_STU as shown in the above figure)
    2 communication, low redundancy, easy expansion
    3 Data independence is high
    4 The data is managed and controlled by the database management system.
    A: Data security protection
    B: Data integrity check
    A: Synchronous control
    D: Restore the database

3. Introduction to MySQL

MySQL is a relational database management system developed by Sweden’s MySQL AB, which is currently a subsidiary of Oracle. MySQL is the most popular MySQL database management system, and it is one of the best RDBMS (Database Management System, Database Management System) application software.

What is MySQL

MySQL -это программное обеспечение на основе архитектуры на основе гнезда
 Клиентское программное обеспечение
 MySQL приходит: например, команда MySQL, команда MySQldump и т. Д.
 Модуль Python: например, PymySQL

Classification of database management software

Две категории:
 Отношения: такие как SQLLITE, DB2, Oracle, Access, SQL Server, MySQL, примечание: SQL Operation Universal
 Нереляционный тип: mongodb, redis, memcache

 Это может быть просто понято как:
         Связанная база данных требует структуры таблицы
         Бесвязочные базы данных хранятся в клавишах, и нет структуры таблицы

4. Download and install

Windows version

#1. Скачать: MySQL Community Server 5.7.16
http://dev.mysql.com/downloads/mysql/

 #2, декомпрессия
 Если вы хотите, чтобы MySQL был установлен в указанном каталоге, то декомпрессированная папка перемещается в указанный каталог, например: C: \ mysql-5.7.16-winx64

 #3. Добавить переменные среды
 [Правой кнопкой мыши компьютер]-"[Properties]-" [Настройки расширенных систем]-"[Advanced]-" [переменная среды]-"[Найдите линию переменных во втором блоке содержимого, Double -click]-> [ Добавьте путь каталога BIN MySQL к значению переменной, используйте; разделите]
 
 #4. Инициализация
mysqld --initialize-insecure

 #5. Начните сервис MySQL
 Mysqld # Начать сервис mysql

 #6. Запустите клиент MySQL и подключите сервис MySQL
 Mysql -u root -p # connect mysql server

When downloading in this way, the server and client will be downloaded together. To learn how to make it easier to start the server and the client, we will work on the company’s server. Later, the company’s server will run on the server, and everyone will connect to the server based on the network connection.

MySQL Server and client:

Сервер mysqld.exe

 Клиент mysql.exe

notice:

При настройке MySQL на ранней стадии терминал CMD должен работать в качестве администратора.

 Windows+R Input Cmd - это обычный пользовательский терминал, который не может быть выполнен, когда есть некоторые команды. Нужно войти в терминал администратора.
 Поиск CMD, правый, нажмите на работу в качестве администратора. Запустите сервер MySQL.

5. Basic management of MySQL

6. I first met the MySQL statement

With MySQL database software, the programmer can be relieved of data management and focus on writing the program logic.

MySQL Server program – MySQLD To help us manage folders and files provided as users, we need to load MySQL Client or other modules to connect to MySQLD and then use the syntax format specified by the MySQL program to send folder or file commands. This syntax is SQL (Structured Query Language which is Structured Query Language)

SQL language is mainly used to access data, query data, update data, and database systems about management relationships. The SQL language was developed by IBM. SQL language is divided into 3 types:

  1. DDL Language Definition Database.
  2. DML Manipulation Language DML statement.
  3. DCL DCL: eg grant user permissions and revoke

                 увеличивать:create database db1 charset utf8;
                 проверять:show databases;
                 изменение:alter database db1 charset latin1;
                 удалять:  drop database db1;


         Сначала переключитесь на папку:use db1
                 увеличивать:create table t1(id int,name char);
                 проверять:show tables;
                 изменение:alter table t1 modify name char(3);
              alter table t1 change name name1 char(2);
                 удалять:drop table t1;    


                 увеличивать:insert into t1 values(1,'egon1'),(2,'egon2'),(3,'egon3');
                 проверять:select * from t1;
                 изменение:update t1 set name='sb' where id=2;
                 удалять:delete from t1 where id=1;

                 Чистая таблица:
            delete from t1; 
            truncate table t1;Количество данных велико, скорость удаления быстрее, чем предыдущая, и начинается непосредственно с нуля.

            auto_increment  Представляет: самостоятельно
            primary key  Представляет: ограничение (не может быть повторен и не может быть пустым); ускорить поиск

Leave a Comment