码迷,mamicode.com
首页 > 数据库 > 详细

数据库的创建

时间:2019-10-27 14:42:03      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:databases   row   rop   名称   har   查看   数据库名   span   col   

创建数据库
CREATE DATABASE 数据库名称;
mysql> CREATE DATABASE itcase;
Query OK, 1 row affected
查看数据库
SHOW DATABASE;
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| itcase |
| itsa |
| mysql |
| performance_schema |
| test |
+--------------------+
6 rows in set
查看某个已经创建的数据库信息
SHOW CREATE DATABASE 数据库名称
mysql> SHOW CREATE DATABASE itcase;
+----------+----------------------------------------------------------------+
| Database | Create Database |
+----------+----------------------------------------------------------------+
| itcase | CREATE DATABASE `itcase` /*!40100 DEFAULT CHARACTER SET gbk */ |
+----------+----------------------------------------------------------------+
1 row in set
修改数据库编码
ALTER DATABASE 数据库名称 DEFAULT CHARACTER SET 数据库编码;
数据库编码有gbk和utf8

mysql> ALTER DATABASE itcase DEFAULT CHARACTER SET utf8;
Query OK, 1 row affected

查看修改后的数据库编码
mysql> SHOW CREATE DATABASE itcase;
+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| itcase | CREATE DATABASE `itcase` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+-----------------------------------------------------------------+
1 row in set
删除数据库
DROP DATABASE 数据库名称;
mysql> DROP DATABASE itcase;
Query OK, 0 rows affected
查看数据库是否删除
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| itsa |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set

数据库的创建

标签:databases   row   rop   名称   har   查看   数据库名   span   col   

原文地址:https://www.cnblogs.com/sxmzs/p/11747336.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!