Home Database Mysql Tutorial MySQL学习笔记_1_MySQL数据库管理系统概述_MySQL

MySQL学习笔记_1_MySQL数据库管理系统概述_MySQL

May 27, 2016 pm 02:12 PM
server client Database management

bitsCN.com

1、 MySQL架构

C/S: client / server架构

MySQL DBMS(Data Bank Management System): 数据库管理系统

客户端 服务器 ---> 数据库 ---> 数据表 ---> (记录/行,字段/列)

/

 

2、 数据库程序员需要精通的操作:(不是DBA(数据库管理员))

一、为项目设计表

二、使用SQL语句(SQL语句编程)

其他、都可以通过工具来完成。

3、MySQL文件结构

配置文件:my.ini: 可以通过修改该文件,来配置MySQL相应的属性

bin文件目录: 保存了MySQL所有的命令

data文件目录: 保存了MySQL所包含的库,各个库里面包含的是相应的 表!

【备份时,只需将data文件夹打包备份出去就可以了,Linux下为var/】

4、SQL语句操作

SQL(Structured Query Language)是一种高级的非过程化的语言。

SQL语句:结构简单,功能强大,简单易学!

按功能划分:

DDL:创建数据库,数据表的语句

DML:操作数据的语句

DQL:数据库查询语句

DCL:数据控制的语句,可以工具执行。

如: /s 查看状态

show databases; 查看所有库

show tables; 查看所有表

desc tables; 查看表结构

show variables; 查看配置文件中的变量

DDL: 1、执行SQL语句,首先要连接到数据库服务器上:

mysql -h localhost -u root -p #以root用户登录到本地数据库

/s:查看数据库状态

show variables;:查看系统中默认配置的变量,谨记:以;结束

show variables like 'time_zone';

show variables like 'port'; : 查看端口

show databases; : 显示系统中所有的库

2、创建数据库

create database [name];

如: create database boost;

3、删除数据库

drop database [name];

如: drop datebase boost;

拓展: cteate database if not exists boost;

drop database if exists boost;

4、创建一张数据表

create table boost.users(id int,name char(30),age int,sex char(3));

5、选择一个库作为默认数据库

use boost;

6、查看所有的表

show tables;

7、查看表结构

desc users;

8、删除表

drop table users; // drop table if exists users;

9、继续在默认数据库中创建

create table users(id int,name char(32),age int,sex char(2));

拓展:

create table is not exists users(id int,name char(32));

10、再创建一张表

create table is not exists articles(title char(64));

DML: 11、插入数据

insert into users values('2012','xiaofang','34','nan');

或: insert into users values(2012,'xiaofang',34,'man'); //弱类型检查

最佳实践: insert into users(id,name,age) values('2334','wangwu','56');

即可插入部分,又可不按顺序插入。

12、更新数据信息

update users set name='AShun' where id='2012';

推广: update users set name='XiaoChang',sex='Nv' where id='2012';

13、删除数据信息

delete from users where id='2012';

推广: delete from users //全部删除

DQL: 14、查看数据信息,查询语句

select * from users;

5、帮助的使用

1、查看帮助所能够提供的信息

? contents;

2、进一步查看详细信息

data types; //需是上面所列出的信息类型

3、更进一步查看具体信息

int;

show;

create tables; // 查看创建表结构语法

update;

bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

VMware Horizon Client cannot be opened [Fix] VMware Horizon Client cannot be opened [Fix] Feb 19, 2024 pm 11:21 PM

VMware Horizon Client helps you access virtual desktops conveniently. However, sometimes the virtual desktop infrastructure may experience startup issues. This article discusses the solutions you can take when the VMware Horizon client fails to start successfully. Why won't my VMware Horizon client open? When configuring VDI, if the VMWareHorizon client is not open, an error may occur. Please confirm that your IT administrator has provided the correct URL and credentials. If everything is fine, follow the solutions mentioned in this guide to resolve the issue. Fix VMWareHorizon Client Not Opening If VMW is not opening on your Windows computer

VMware Horizon client freezes or stalls while connecting [Fix] VMware Horizon client freezes or stalls while connecting [Fix] Mar 03, 2024 am 09:37 AM

When connecting to a VDI using the VMWareHorizon client, we may encounter situations where the application freezes during authentication or the connection blocks. This article will explore this issue and provide ways to resolve this situation. When the VMWareHorizon client experiences freezing or connection issues, there are a few things you can do to resolve the issue. Fix VMWareHorizon client freezes or gets stuck while connecting If VMWareHorizon client freezes or fails to connect on Windows 11/10, do the below mentioned solutions: Check network connection Restart Horizon client Check Horizon server status Clear client cache Fix Ho

How to install, uninstall, and reset Windows server backup How to install, uninstall, and reset Windows server backup Mar 06, 2024 am 10:37 AM

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

PHP MQTT Client Development Guide PHP MQTT Client Development Guide Mar 27, 2024 am 09:21 AM

MQTT (MessageQueuingTelemetryTransport) is a lightweight message transmission protocol commonly used for communication between IoT devices. PHP is a commonly used server-side programming language that can be used to develop MQTT clients. This article will introduce how to use PHP to develop an MQTT client and include the following content: Basic concepts of the MQTT protocol Selection and usage examples of the PHPMQTT client library: Using the PHPMQTT client to publish and

How to solve the problem that the Baidu Netdisk webpage cannot start the client? How to solve the problem that the Baidu Netdisk webpage cannot start the client? Mar 13, 2024 pm 05:00 PM

When many friends download files, they will first browse on the web page and then transfer to the client to download. But sometimes users will encounter the problem that the Baidu Netdisk webpage cannot start the client. In response to this problem, the editor has prepared a solution for you to solve the problem that the Baidu Netdisk webpage cannot start the client. Friends in need can refer to it. Solution: 1. Maybe Baidu Netdisk is not the latest version. Manually open the Baidu Netdisk client, click the settings button in the upper right corner, and then click version upgrade. If there is no update, the following prompt will appear. If there is an update, please follow the prompts to update. 2. The detection service program of Baidu Cloud Disk may be disabled. It is possible that we manually or use security software to automatically disable the detection service program of Baidu Cloud Disk. Please check it out

What is the mobile client What is the mobile client Aug 16, 2023 pm 01:40 PM

A mobile client refers to an application that runs on a smartphone and provides users with various functions and services in the form of a native client or a web client. Mobile clients can be divided into two forms: original clients and web clients. Native clients refer to applications written for specific operating systems using specific programming languages ​​and development tools. The advantage of web clients is that they have good cross-platform compatibility. , can run on different devices without operating system restrictions, but compared to the native client, the performance and user experience of the web client may be reduced.

How to write an FTP client in PHP How to write an FTP client in PHP Aug 01, 2023 pm 07:23 PM

How to write an FTP client in PHP 1. Introduction FTP (File Transfer Protocol) is a protocol used for file transfer on the network. In web development, we often need to upload or download files through FTP. As a popular server-side language, PHP provides powerful FTP functions, allowing us to easily write FTP clients. This article will introduce how to write a simple FTP client using PHP and provide code examples. 2. Connect to the FTP server in PHP, we can use f

Windows Server 2025 preview version welcomes update, Microsoft improves Insiders testing experience Windows Server 2025 preview version welcomes update, Microsoft improves Insiders testing experience Feb 19, 2024 pm 02:36 PM

On the occasion of releasing the build 26040 version of Windows Server, Microsoft announced the official name of the product: Windows Server 2025. Also launched is the Windows11WindowsInsiderCanaryChannel version build26040. Some friends may still remember that many years ago someone successfully converted Windows NT from workstation mode to server mode, showing the commonalities between various versions of Microsoft operating systems. Although there are clear differences between Microsoft's current version of the server operating system and Windows 11, those who pay attention to the details may be curious: why Windows Server updated the brand,

See all articles