久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

Mysql如何創建數據庫

150次閱讀
沒有評論

共計 3675 個字符,預計需要花費 10 分鐘才能閱讀完成。

丸趣 TV 小編給大家分享一下 Mysql 如何創建數據庫,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

4.1 create and drop database

C:\Users\admin mysql -h localhost -u root -pmysql

mysql: [Warning] Using a password on the
command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.14 MySQL Community
Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its
affiliates. All rights reserved.

Oracle is a registered trademark of Oracle
Corporation and/or its

affiliates. Other names may be trademarks
of their respective

owners.

Type help; or \h for help. Type \c to
clear the current input statement.

mysql
show databases;

+——————–+

| Database  |

+——————–+

| information_schema |

| mysql  |

| performance_schema |

| sys  |

| test  |

+——————–+

5 rows in set (0.00 sec)

mysql
create database example;  #create
database

Query OK, 1 row affected (0.04 sec)

mysql
show databases; 
#顯示 databases

+——————–+

| Database  |

+——————–+

| information_schema |

| example  |

| mysql  |

| performance_schema |

| sys  |

| test  |

+——————–+

6 rows in set (0.00 sec)

mysql drop database example;  #drop database;

Query OK, 0 rows affected (0.04 sec)

mysql show databases;

+——————–+

| Database  |

+——————–+

| information_schema |

| mysql  |

| performance_schema |

| sys   |

| test  |

+——————–+

5 rows in set (0.00 sec)

mysql create database mysql;

ERROR 1007 (HY000): Can t create database
mysql database exists

mysql create database mydata;

Query OK, 1 row affected (0.01 sec)

4.2
存儲引擎

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

4.2.1 InnoDB engine

InnoDB 是 mysql 數據庫中的存儲引擎,innodb 給 mysql 的表提供了事務,回滾,崩潰修復能力,多版本并發控制的事務安全

(1)  Innodb 那個。存儲引擎支持自動增長列 auto_increment.

(2)  Innodb 存儲引擎支持外鍵 (foreign
key)

(3)  Innodb 存儲引擎,創建的表的表結構在.frm 文件中,數據和索引存儲在 innodb_data_home_dir 和 innodb_data_file_path 定義的表空間

(4)  Innodb 存儲引擎的缺點是讀寫效率稍差,占用的數據空間相對較大。

4.2.2 MyISAM engine

MyISAM 是 mysql 中常見的存儲引擎

MyISAM 存儲引擎的表存儲成三個文件。文件的名字與表名相同,擴展名包括 frm,MYD,MYI,

. 其中 frm 為擴展名的文件存儲表的結構;MYD(MYData) 為擴展名的文件存儲數據,MYI(MYindex) 為擴展名的文件存儲引擎

MyISAM 存儲引擎的優勢在于占用空間小,處理速度快。缺點是不支持事務的完整性和并發性。

 

4.2.3 MEMORY

特殊存儲引擎, 表結構在 disk 上,數據在內存中。

Memory 表的大小受到顯示,表的大小取決于兩個參數 max_rows 和 max_heap_table_size

4.2.4 engines 的選擇.

特性

InnoDB

MyISAM

MEMORY

事務安全

支持

存儲限制

64TB

空間使用

內存使用

插入數據的速度

對外鍵的遲滯

支持

以上是“Mysql 如何創建數據庫”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注丸趣 TV 行業資訊頻道!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-26發表,共計3675字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 凤阳县| 渭南市| 霍城县| 洛宁县| 泾阳县| 北宁市| 锡林郭勒盟| 红原县| 濉溪县| 甘泉县| 鄱阳县| 兰州市| 博爱县| 华宁县| 香河县| 潜山县| 罗甸县| 山阴县| 株洲市| 德令哈市| 桦甸市| 清新县| 宁强县| 棋牌| 四平市| 垣曲县| 叶城县| 锡林浩特市| 蕉岭县| 洛浦县| 会宁县| 红原县| 东阿县| 舒兰市| 兴海县| 娄底市| 富锦市| 巴塘县| 望奎县| 桑植县| 江华|