mysql命令補充

2021-08-11 01:43:24 字數 1336 閱讀 8229

1.mysql修改字段允許為空

alter

table表名 modify欄位名字段型別(長度) null;

1.新增普通索引

alter

table table_name add index index_name (column_list)

2.新增唯一索引

alter

table table_name add

unique (column_list)

3.新增主鍵索引

alter

table table_name add

primary

key (column_list)

4.強制使用索引

mysql強制使用索引:force index(索引名或者主鍵pri)

例如:select * from

table force index(pri) limit 2;(強制使用主鍵)

select * from

table force index(ziduan1_index) limit 2;(強制使用索引"ziduan1_index")

select * from

table force index(pri,ziduan1_index) limit 2;(強制使用索引"pri和ziduan1_index")

5.禁止使用索引

mysql禁止某個索引:ignore index(索引名或者主鍵pri)

例如:select * from

table ignore index(pri) limit 2;(禁止使用主鍵)

select * from

table ignore index(ziduan1_index) limit 2;(禁止使用索引"ziduan1_index")

select * from

table ignore index(pri,ziduan1_index) limit 2;(禁止使用索引"pri,ziduan1_index")

1.檢視事務隔離級別

//系統級別

select @@global.tx_isolation;

//回話級別

select @@tx_isolation;

2.設定資料庫隔離級別

set [session | global] transaction

isolation

level

shell命令補充

使用者管理 使用者身份 whoami 檢視登陸使用者 who a h 檢視使用者的操作 w 使用者間切換 su username 目錄管理 建立目錄 mkdir directoryname 刪除目錄 rmdir directoryname 顯示工作目錄 pwd 顯示目錄內容 ls a l 改變當前目...

gvim 命令補充

刪除沒有內容的空行 g d 刪除包含有空格組成的空行 g s d 以空格或tab開頭到結尾的空行 g t d s r g 刪除dos方式的回車 m s 刪除行尾空白 s n1 1 刪除重複行 s pdf new.pdf 只是刪除第乙個pdf s 又是刪除多行注釋 咦?為什麼要說 又 呢?g s d ...

linux命令補充

新建檔案 cat create linux file.txt 顯示程序 ps eaf grep 檢視服務監聽埠 netstat tln 檢視程序號 netstat 全部程序檢視 ps aux more 強制殺掉程序號 kill 9 常用修改許可權的命令 sudo chmod 600 只有所有者有讀和...