標籤:資料表 許可權 指定 nal mysql簡介 根據 安全 表名 命令
mysql:關係型資料庫管理系統(RDBMS 即 relational database management system)
什麼是資料庫:資料庫是根據資料結構來組織、儲存和管理資料的倉庫。它是一些關聯表的集合。
- 資料表: 表是資料的矩陣。在一個資料庫中的表看起來像一個簡單的試算表。
- 列: 一列(資料元素) 包含了相同的資料, 例如郵遞區號的資料。
- 行:一行(=元組,或記錄)是一組相關的資料,例如一條使用者訂閱的資料。
- 冗餘:儲存兩倍資料,冗餘降低了效能,但提高了資料的安全性。
- 主鍵:主鍵是唯一的。一個資料表中只能包含一個主鍵。你可以使用主鍵來查詢資料。
- 外鍵:外鍵用於關聯兩個表。
- 複合鍵:複合鍵(按鍵組合)將多個列作為一個索引鍵,一般用於複合索引。
- 索引:使用索引可快速存取資料庫表中的特定資訊。索引是對資料庫表中一列或多列的值進行排序的一種結構。類似於書籍的目錄。
doc命令添加mysql使用者執行個體
use mysql;insert into user(hos,user,password,select_priv,insert_priv,update_priv) values(‘localhost‘,‘demo‘,PASSWORD(‘123‘),‘Y‘,‘Y‘,‘Y‘);//授權使用者可進行 SELECT, INSERT 和 UPDATE操作許可權FLUSH PRIVILEGES;//這個命令執行後會重新載入授權表 select host,user,password from user where user=‘demo‘;
刪除mysql使用者
delete from user where user = ‘demo‘;
管理資料庫常用命令
show databases; //顯示資料庫列表use demo;//選擇一個資料庫show tables;//顯示指定資料庫的所有資料表show index from table_demo;//顯示資料表的索引資訊show table statiu from table_demo; // 顯示資料庫 table_demo 中所有表的資訊show table statiu from table_demo LIKE ‘table_demo%‘; //表名以table_demo開頭的表的資訊show table statiu from table_demo LIKE ‘table_demo%‘\G; //加上 \G,查詢結果按列列印net start mysql //啟動mysql服務net stop mysql //關閉mysql服務
mysql簡介以及常用dos命令