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

数据库的基本操作

时间:2020-04-14 16:48:09      阅读:76      评论:0      收藏:0      [点我收藏+]

标签:hive   red   nes   isa   value   character   null   def   error   

创建数据库
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.35 sec)
mysql> CREATE DATABASE test_db;
Query OK, 1 row affected (0.01 sec)
mysql> show create database tese_db;
ERROR 1049 (42000): Unknown database ‘tese_db‘
mysql> show create database test_db;
+----------+------------------------------------------------------------------+
| Database | Create Database |
+----------+------------------------------------------------------------------+
| test_db | CREATE DATABASE test_db /!40100 DEFAULT CHARACTER SET utf8 / |
+----------+------------------------------------------------------------------+
1 row in set (0.00 sec)
删除数据库

mysql> DROP DATABASE test_db;
Query OK, 0 rows affected (0.09 sec)
数据库存储引擎
mysql> SHOW ENGINES\G
1. row
Engine: InnoDB
Support: DEFAULT
Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
2. row
Engine: MRG_MYISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
3. row
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
4. row
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
5. row
Engine: MyISAM
Support: YES
Comment: MyISAM storage engine
Transactions: NO
XA: NO
Savepoints: NO
6. row
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
7. row
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
8. row
Engine: PERFORMANCE_SCHEMA
Support: YES
Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
9. row
Engine: FEDERATED
Support: NO
Comment: Federated MySQL storage engine
Transactions: NULL
XA: NULL
Savepoints: NULL
9 rows in set (0.00 sec)
查看默认存储引擎
mysql> show variables like ‘default_storage_engine‘;
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
+------------------------+--------+
1 row in set (0.00 sec)

数据库的基本操作

标签:hive   red   nes   isa   value   character   null   def   error   

原文地址:https://blog.51cto.com/14471717/2487264

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