MySQL学习笔记2:数据库的基本操作(创建删除查看)
我们所安装的MySQL说白了是一个数据库的管理工具,真正有价值的东西在于数据关系型数据库的数据是以表的形式存在的,N个表汇总在一起就成了一个数据库现在来看看数据库的基本操作
我们所安装的MySQL说白了是一个数据库的管理工具,真正有价值的东西在于数据关系型数据库的数据是以表的形式存在的,N个表汇总在一起就成了一个数据库现在来看看数据库的基本操作无非就是三点:创建 删除 查看
创建数据库
代码如下:
mysql> create database school;
Query OK, 1 row affected (0.00 sec)
create database语句用于创建数据库
后面的school是数据库的名字,分号结束
执行成功则会显示Query OK,还有执行时间
有了数据库之后,一般情况下会查看当前数据库
查看数据库
代码如下:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| school |
| test |
+--------------------+
rows in set (0.00 sec)
这样便显示了创建的数据库,其中school是刚刚创建的
其余几个默认存在,不要乱动
test是给你做测试使用,可以删除
删除数据库
代码如下:
mysql> drop database school;
Query OK, 0 rows affected (0.00 sec)
删除也很简单,drop database 命令即可
接下来就可以使用show databases查看效果要注意的是语句后面不要忘记分号在实际中,我们操作更多的不是数据库,而是数据库中的表所以这里的内容显得很简单

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Is it true that you can be blocked and deleted on WeChat and permanently unable to be added?

Check out the steps to delete a logged-in device on Douyin

How to completely delete TikTok chat history

How to send files to others on TikTok? How to delete files sent to others?

How can I retrieve someone else's deleted comment on Xiaohongshu? Will it be displayed if someone else's comment is deleted?

How to check your own ID on Xianyu_Introduction to how to check your personal nickname on Xianyu

PHP Practical Tip: Remove the last semicolon in your code
