当前位置:网站首页>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 .
边栏推荐
- 深度学习之Numpy篇
- Union, intersection and difference operations in SQL
- 【Mysql系列】工作常用sql集锦(持续更新)
- 問題解决:虛擬機無法複制粘貼文件
- Refresh the strong pointer assignment problem in the HP-UX system of Sanguan
- JS mobile terminal touch screen event
- 成功解决之idea引用Lombok的@Slf4j后无法正常使用log
- 50 lines of code to crawl TOP500 books and import TXT documents
- 微信小程序 自定义 弹框组件
- To: Apple CEO Cook: great ideas come from constantly rejecting the status quo
猜你喜欢
随机推荐
tsconfig. json
Current limiting design and Implementation
Summary of several common UML diagrams
Commodity seckill system
知識點總結
To: seek truth from facts
Why don't I recommend going to sap training institution for training?
微信小程序 自定义 弹框组件
NFTGameFi链游系统开发详解方案丨链游系统开发原理解析
String string is converted to jsonarray and parsed
手机影像内卷几时休?
JS mobile terminal touch screen event
Installation and use of filebeat
关于不等式取值转义的思路
Tiktok practice ~ search page ~ video details
Microservice architecture
Several delete operations in SQL
SSO微服务工程中用户行为日志的记录
Invocation failed Unexpected end of file from server
【推荐收藏】这8个常用缺失值填充技巧一定要掌握









