当前位置:网站首页>MySQL - database creation and management
MySQL - database creation and management
2022-06-26 19:24:00 【Wan Li Gu Cheng】
List of articles
MySQL—— Database creation and management
1、 Create database
CREATE DATABASE Statement is used to create a new SQL database .
Syntax and extension
-- Create directly
CREATE DATABASE database_name;
-- Create a database and specify the character set
CREATE DATABASE database_name character set 'gbk';
-- If it does not exist, the creation is successful , If it already exists, the creation is unsuccessful , But there is no error
CREATE DATABASE if NOT exists database_name character set 'utf-8';
-- View the structure of the created database
show create database database_name
Database name (database_name) In the same RDBMS It has to be the only one .
Create a database instance
CREATE DATABASE mytestdb;

2、 Using a database
If SQL There are multiple databases in the schema , So before starting the operation , You need to select a database that will perform the operation .
USE Statement is used to select any existing database in the user .
grammar :
-- Currently connected to an existing database
show database
-- Specify the database to use
USE database_name;
-- View currently used databases
select database()
3、 Delete database
DROP DATABASE Statement is used to delete the existing database in the user .
grammar
DROP DATABASE if exists database_name;
If you want to delete an existing database mytestdb, be DROP DATABASE The statement is as follows -
DROP DATABASE if exists mytestdb;
Be careful Be careful before using this operation , Because deleting an existing database will delete the complete information stored in this database , such as : surface , function , Views and so on will be deleted together .
边栏推荐
- Boot指标监测
- Numpy's Matplotlib
- 成功解决之Jenkins报错:The goal you specified requires a project to execute but there is no POM
- Pinda general permission system (day 1~day 2)
- Leetcode 128 longest continuous sequence
- Selection of database paradigm and main code
- Using cache in vuex to solve the problem of data loss in refreshing state
- Leetcode interview question 29 clockwise print matrix
- 项目实战六:分布式事务-Seata
- System table SQLite of SQLite database_ master
猜你喜欢

Leetcode interview question 29 clockwise print matrix

Commodity seckill system

Minimum spanning tree, shortest path, topology sorting, critical path

The successfully resolved idea cannot use the log normally after referencing Lombok's @slf4j

微信小程序 自定义 弹框组件
![[kubernetes] kubernetes principle analysis and practical application (under update)](/img/37/40b8317a4d8b6f9c3acf032cd4350b.jpg)
[kubernetes] kubernetes principle analysis and practical application (under update)

Feign远程调用

抖音实战~分享模块~复制短视频链接

ARM裸板调试之串口打印及栈初步分析

项目实战四:用户登录及token访问验证(reids+jwt)
随机推荐
Redis single sign on system + voting system
Using cache in vuex to solve the problem of data loss in refreshing state
Soft test preparation multimedia system
The goal you specified requires a project to execute but there is no POM
8VC Venture Cup 2017 - Final Round C. Nikita and stack
String string is converted to jsonarray and parsed
mysql的充值问题
Successfully solved the problem of garbled microservice @value obtaining configuration file
Unit test of boot
ROS query topic specific content common instructions
关于Qt数据库开发的一些冷知识
Nftgamefi chain game system development detailed solution - chain game system development principle analysis
问题解决:虚拟机无法复制粘贴文件
Project practice 5: build elk log collection system
知识点总结
(树) 树状数组
抖音实战~首页视频~下拉刷新
Project practice 6: distributed transaction Seata
Tiktok practice ~ sharing module ~ short video download (save to photo album)
手机影像内卷几时休?