当前位置:网站首页>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篇
- Refresh the strong pointer assignment problem in the HP-UX system of Sanguan
- The goal you specified requires a project to execute but there is no POM
- xlua获取ugui的button注册click事件
- 抖音实战~搜索页面~扫描二维码
- C# 练习。类列表加记录,显示记录和清空记录
- Solidity - contract inheritance sub contract contains constructor errors and one contract calls the view function of another contract to charge gas fees
- 【推荐收藏】这8个常用缺失值填充技巧一定要掌握
- 一些基本错误
- The king of Internet of things protocol: mqtt
猜你喜欢
随机推荐
50 lines of code to crawl TOP500 books and import TXT documents
stm32和电机开发(直流有刷电机和步进电机)
Tiktok practice ~ sharing module ~ short video download (save to photo album)
(树) 树状数组
Xlua get button registration click event of ugui
一些基本错误
Create a time blocker yourself
mysql的充值问题
品达通用权限系统(Day 3~Day 4)
Deep learning: numpy
Redis single sign on system + voting system
微信小程序 uniapp 左滑 删除 带删除icon
Reading notes: process consulting III
Image binarization
redis 基础知识
Publish message publishers and subscribe message subscribers of ROS
NFTGameFi链游系统开发详解方案丨链游系统开发原理解析
微服务架构
tsconfig. json
Kubernetes resource topology aware scheduling optimization








