MySQL (1)

1. Introduction to the database


 

What is a database?

A database is a warehouse that organizes, stores, and manages data according to data structures.
Each database has one or more different APIs for creating, accessing, managing, searching, and replicating the stored data.
We can also store data in files, but reading and writing data in files is relatively slow.
So, now we use relational database management systems (RDBMS) to store and manage large volumes of data. The so-called relational database is a database based on the relational model, which uses mathematical concepts and methods such as set algebra to process the data in the database.
Features of RDBMS (Relational Database Management System):
1. The data is presented in the form of a table
2. Each row has various record names
3. Each column corresponds to the data field of the record name
4. Many rows and columns Form a form
5. Several forms form a database

The following figure is a database

RDBMS terminology 

Before we start learning about MySQL databases, let's understand some RDBMS terminology:

  Database : A database is a collection of related tables. . · Data table : A table is a matrix of data. A table in a database looks like a simple spreadsheet. Columns : A column (data element) contains the same data, such as zip code data. Row : A row (=tuple, or record) is a group of related data, such as a piece of data subscribed by a user. Redundancy : Store twice the data , redundancy can make the system faster. (The higher the degree of normalization of the table, the more the relationship between the table and the table; the query may often require a join query between multiple tables; and the join operation will slow down the query speed. For example, student information is stored in In the student table, the information of the department is stored in the department table. A relationship is established with the department table through the dept_id field in the student table. If you want to query the name of a student's department, you must find the student's department number in the student table ( dept_id), and then go to the department to find the name of the department according to this number. If this operation is often required, the connection query will waste a lot of time. Therefore, a redundant field dept_name can be added to the student table, which is used to store the student's location. The name of the department. This eliminates the need to connect each time.) · Primary key : The primary key is unique. A data table can only contain one primary key. You can use the primary key to query data. Foreign key : A foreign key is used to associate two tables. · Composite key : A composite key (composite key) uses multiple columns as an index key, and is generally used for composite indexes.
  
  
  
  
  
  
  
  · Indexes : Use indexes to quickly access specific information in a database table. An index is a structure that sorts the values ​​of one or more columns in a database table. A catalogue similar to a book. Referential Integrity : Referential integrity requires that no reference to a non-existent entity be allowed in a relationship . Entity integrity is an integrity constraint that a relational model must satisfy, in order to ensure data consistency.
  


Mysql database

Mysql is the most popular relational database management system, and MySQL is one of the best RDBMS (Relational Database Management System: relational database management system) application software in WEB application. Developed by the Swedish MySQL AB company, it currently belongs to the Oracle company. MySQL is a relational database management system, relational databases keep data in different tables instead of keeping all the data in one big warehouse, which increases speed and improves flexibility.

  Mysql is open source , so you don't need to pay extra.
  · Mysql supports large databases. Can handle large databases with tens of millions of records.
  · MySQL uses the standard SQL data language form.
  · Mysql can be allowed on multiple systems and supports multiple languages. These programming languages ​​include C, C++, Python, Java, Perl, PHP, Eiffel, Ruby, and Tcl, among others.
  · Mysql has good support for PHP, which is currently the most popular web development language.
  MySQL supports large databases and data warehouses with 50 million records. The maximum table file supported by 32-bit system is 4GB, and the maximum table file supported by 64-bit system is 8TB.
  · Mysql can be customized, using the GPL protocol, you can modify the source code to develop your own Mysql system.

 

2. Installation and use of the database (windows)


 

1. Database installation

(PS: Now I have the urge to hit people. This stupid mouse will drop the page X every time I edit it here. I will slap him! I can't bear it! I can't bear it!)

Now let's talk about the download and installation of the database!

First of all, I am using the mysql-5.7.20 version, which I personally find very useful!

######download link######
https://dev.mysql.com/downloads/windows/installer/5.7.html


######Installation Tutorial######
https://www.cnblogs.com/xiaodingdong/p/7223245.html


ps: This little brother is very detailed, follow the installation!

 2. Use of mysql

After mysql is installed, then it's time to play with it and start ravaging it!

First, the shortcut key Win+R will pop up this window

After opening Li, enter cmd to enter the operation terminal! enter after

net start MYSQL57

PS: MYSQL57 is the database terminal name that I created myself, so the database terminal name you created shall prevail. At this time, the mysql server has been opened.

The instructions for my colleagues to shut down the server are:

net stop MYSQL57

I won't show the effect, try it yourself

After the server starts, you need to enter the username and password you created when you installed the database earlier

Format: mysql -u (username) -p (password)


#For example , to enter my username and password to enter the database # My username:root, password:sutaoyu01 #So 
the command is 
mysql -uroot -psutaoyu01

In this way, you have successfully entered the database! You can operate on the database!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325906045&siteId=291194637