MySQL数据库——数据库基础
(一)为什么使用数据库
- 数据库用来存储海量数据
- 数据库利于数据查询和管理
- 数据库相对于文件安全性更高
- 数据库相对于文件利于控制
(二)MySQL的基本使用
- 安装好MySQL数据库以后,连接服务器。
(1)输入:mysql -h 127.0.0.1 -P 3306 -u root -p
不写 -h 127.0.0.1的话默认为本地连接;
-P :代表端口名,默认为3306
-u:代表用户名
-p:代表密码,不用在此处输入密码,回车有提示
(2)输出:Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21-log MySQL Community Server (GPL)
Copyright © 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> - 服务器,数据库,表之间的关系
(1)每个数据库服务器下管理多个数据库(一般每一个应用建一个数据库);
(2)每个数据库中可以建多个表(保存应用中的实体数据)。
(3)服务器,数据库,表之间的关系图
实例理解:client客户端——自己
MySQL数据库服务器——图书馆
DB(数据库)——图书馆里的每个房间
表——每个房间里书的分类
3. 数据的存储逻辑
对于表来说,二维存储,有行和列
(三)MySQL分类
(四)存储引擎
(1)存储引擎:数据库管理系统如何存储数据、如何为存储的数据建立索引和如何更新、查询数据等技术的实现方法。
(2)MySQL的核心就是插件式存储引擎,支持多种存储引擎。
(3)查看存储引擎。
show engines;