当前位置:网站首页>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 .
边栏推荐
猜你喜欢
随机推荐
【推荐收藏】这8个常用缺失值填充技巧一定要掌握
When does the mobile phone video roll off?
Why don't I recommend going to sap training institution for training?
The king of Internet of things protocol: mqtt
抖音实战~分享模块~生成短视频二维码
Preliminary analysis of serial port printing and stack for arm bare board debugging
成功解决之idea引用Lombok的@Slf4j后无法正常使用log
To: Apple CEO Cook: great ideas come from constantly rejecting the status quo
Pinda general permission system (day 1~day 2)
成功解决之微服务@Value获取配置文件乱码问题
The eigen library calculates the angle between two vectors
Request method 'POST' not supported
字符串String转换为jsonArray并解析
redis 基础知识
股票开户的具体步骤是什么?网上开户安全吗?
460million zongzi were sold in half a year. How big is the "imagination space" of time-honored brands?
Usage and difference between ros:: spinonce() and ros:: spin()
Yujun product methodology
vuex中利用缓存解决刷新state数据丢失问题
String string is converted to jsonarray and parsed









