Article Directory
foreword
Today, I will continue to explain MySQL-related content. This issue mainly explains the basic concepts of databases to facilitate subsequent learning of databases.
connect to the server
mysql -h [ip] -P [port] -u [root] -p
-h:指明登录部署了mysql服务的主机
-P:指明访问的端口号
-u:指明登录用户
-p:指明密码
quit # 退出
What is a database? MySQL and MySQLd
1
MySQL is the client side of the database service, and MySQLd is the server side of the database service.
MySQL is essentially a network service based on CS mode.
2
MySQL is a set of network programs that provide us with data access services. Databases generally refer to data organized in a specific structure stored on disk or in memory – a set of database solutions that will be stored on disk in the future.
MySQLd – specifically refers to the database service
3.
Files provide storage capabilities, but files do not provide good data management capabilities (for users). The
essence of databases: a set of solutions for data content storage, put forward requirements, and directly give results
How to see the database file in Linux
When entering a command in mysql to create a database, the command will be communicated to mysqld, who will help us create the database. As can be seen from the figure, creating a database is essentially creating a directory.
Create a student table, you can see that two files have been created in this directory.
Therefore, the database itself is also a file, which is only operated by the database service mysqld for us.
Classification of SQL statements
DDL [data definition language]
data definition language, used to maintain the structure of stored data
Representative instructions: create, drop, alter
DML [data manipulation language]
data manipulation language, used to operate on data
Representative instructions: insert, delete, update
In DML, there is a separate DQL
data query language
representative instruction: select
DCL [Data Control Language]
data control language, mainly responsible for authority management and transaction
representative instructions: grant, revoke, commit
storage engine
The storage engine directly deals with the file system and is the part that actually manages data operations.