03 mysql補充 (進階)
增加字段 alter table tb1 add age int first; 增加到第一 alter table tb1 add sex int after id; # 改變位置,id是字段名字 alter table tb1 modify age varchar(10); # 修改類型 alter table tb1 change age sex varchar(10); # 更改字段,類型不變 alter table tb1 tb1 rename ta2; # 更改表名字 alter table tb1 drop age; # 刪除字段 drop user 用戶名 # 刪除用戶
03 mysql補充 (進階)
相關推薦
03 mysql補充 (進階)
color 增加字段 div char ren tab mys var 表名 增加字段 alter table tb1 add age int first; 增加到第一 alter table tb1 add sex int after id; # 改變位置,id是字
MySQL學習進階
inf primary 文件 rom 主鍵約束 fault 文本文件 delet 介紹 存儲引擎 MyISAMMySQL 5.0 之前的默認數據庫引擎,最為常用。擁有較高的插入,查詢速度,但不支持事務 InnoDB事務型數據庫的首選引擎,支持ACID事務,支持行級鎖定, M
mysql 開發進階篇系列 5 SQL 優化
其它 目的 block 垂直拆分 例如 info 分析 設計 plain 一. 使用sql提示 sql 提示(sql hint)是優化數據庫的一個重要手段, 是在sql語句中加入一些人為的提示來達到優化操作的目的。 1.1 use index
mysql 開發進階篇系列 6 鎖問題
訪問 vcc 不同 gin 存儲引擎 rhs 出現 詳細 方法 一.概述 在數據庫中,數據是屬於共享資源,為了保證並發訪問的一致性,有效性,產生了鎖。接下來重點討論mysql鎖機制的特點,常見的鎖問題,以及解決mysql鎖問題的一些方法或建議。 相比其他數據庫,mysq
mysql 開發進階篇系列 12 鎖問題(隔離級別下鎖的差異)
padding 排它 改變 level order 並發 aci delete 恢復 1. innodb在不同隔離級別下的一致性讀及鎖的差異 不同的隔離級別下,innodb處理sql 時采用的一致性讀策略和需要的鎖是不同的,同時,數據恢復和復制機制的特點,也對一些sql
mysql 開發進階篇系列 14 鎖問題(避免死鎖,死鎖查看分析)
mysq cit 優化 業務流程 update span tro isp 問題 一. 概述 通常來說,死鎖都是應用設計問題,通過調整業務流程,數據庫對象設計,事務大小,以及訪問數據庫的sql語句,絕大部分死鎖都可以避免,下面介紹幾種避免死鎖的常用 方法. 1. 在應
mysql 開發進階篇系列 23 應用層優化與查詢緩存
http lang 單位 tro source 局限 pooling 內存不足 unit 一.概述 前面章節介紹了很多數據庫的優化措施,但在實際生產環境中,由於數據庫服務器本身的性能局限,就必須要對前臺的應用來進行優化,使得前臺訪問數據庫的壓力能夠減到最小。
mysql 開發進階篇系列 34 工具篇 mysqlcheck(MyISAM表維護工具)
alt 1.4 width pwd table 方式 選項 ble 優化 一.概述 mysqlcheck客戶端工具可以檢查和修復MyISAM表,還可以優化和分析表。實際上,它集成了mysql工具中check,repair,analyze,optimize功
mysql 開發進階篇系列 55 權限與安全(安全事項 )
應該 htm set 傳輸 深入 weight 本地 圖片 dmi 一. 操作系統層面安全 對於數據庫來說,安全很重要,本章將從操作系統和數據庫兩個層面對mysql的安全問題進行了解。 1. 嚴格控制操作系統賬號和權限 在數據庫服務器上要嚴格控制操作系統
mysql 開發進階篇系列 54 許可權與安全(賬號管理的各種許可權操作 下)
1. 檢視許可權 -- 如果host值不是%, 就要加上host值,下面檢視bkpuser使用者許可權(6個許可權, 限本地連線) SHOW GRANTS FOR bkpuser@localhost; -- 如果host值是%, 就只要輸入使用者名稱,下面檢視z1使用者許可權(
mysql 開發進階篇系列 51 許可權與安全(許可權表user,db詳細介紹 )
一.概述 mysql 的許可權系統主要用來對連線到資料庫的使用者進行許可權驗證,以此來判斷此使用者是否屬於合法使用者,以及合法使用者給予的相應資料庫許可權。下面將介紹許可權系統的工作原理,以及將要熟練掌握賬號的管理和使用方法(mysql版本 5.7)。 1.1 許可權系統的
Django基礎之form表單的補充進階
1. 應用Bootstrap樣式 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="x-ua-compatible" conte
mysql 開發進階篇系列 40 mysql日誌之二進位制日誌下以及查詢日誌
一.binlog 二進位制其它選項 在二進位制日誌記錄了資料的變化過程,對於資料的完整性和安全性起著非常重要作用。在mysql中還提供了一些其它引數選項,來進行更小粒度的管理。 1.1 binlog-do-db=db_name 該選項告訴主伺服器,當前db_name庫會更新記錄到二進位制日誌中
mysql 開發進階篇系列 41 mysql日誌之慢查詢日誌
一.概述 慢查詢日誌記錄了所有的超過sql語句( 超時引數long_query_time單位 秒),獲得表鎖定的時間不算作執行時間。慢日誌預設寫入到引數datadir(資料目錄)指定的路徑下。預設檔名是[hostname]_slow.log,預設超時是10秒,預設不開啟慢查詢日誌。下面檢視慢
mysql 開發進階篇系列 42 邏輯備份與恢復
一.概述 在作何資料庫裡,備份與恢復都是非常重要的。好的備份方法和備份策略將會使得資料庫中的資料更加高效和安全。對於DBA來說,進行備份或恢復操作時要考慮的因素大概有如下: (1) 確定要備份的表的儲存引擎是事務型(innodb)還是非事務型。兩種不同的儲存引擎備份方式在處理資料一致性方面
mysql 開發進階篇系列 43 邏輯備份與恢復(基於時間和位置的不完全恢復)
一. 概述 在上篇講到了邏輯備份,使用mysqldump工具來備份一個庫,並使用完全恢復還原了資料庫。在結尾也講到了誤操作是不能用完全恢復的。解決辦法是:我們需要恢復到誤操作之前的狀態,然後跳過誤操作語句。再恢復後面執行的語句,完成我們的恢復,這種恢復叫“不完全恢復”。在mysql 中,不完
mysql 開發進階篇系列 44 物理備份與恢復( 熱備份xtrabackup 工具介紹)
一.概述 物理備份和恢復又分為冷備份和熱備份。與邏輯備份相比,它最大優點是備份和恢復的速度更快。因為物理備份的原理都是基於檔案的cp。 1.1 冷備份 冷備份就是停掉資料庫服務。這種物理備份一般很少使用,因為很多應用是不允許長時間停機的。恢復操作大概是:首先停掉mysql服務, 在作業系統級別恢
mysql 開發進階篇系列 45 xtrabackup 安裝與使用者許可權說明(系統使用者和mysql使用者)
一. 安裝說明 安裝XtraBackup 2.4 版本有三種方式: (1) 儲存庫安裝Percona XtraBackup(推薦) (2 )下載的rpm或apt包安裝Percona XtraBackup。 (3) 原始碼編譯和安裝。 Pe
mysql 開發進階篇系列 46 xtrabackup (選項說明,增加備份使用者,完全備份案例)
一. xtrabackup 選項說明 在操作xtrabackup備份與恢復之前,先看下該工具的選項,下面記錄了xtrabackup二進位制檔案的部分命令列選項,後期把常用的選項在補上。點選檢視xtrabackup Option 指南 選項名 說明 --apply-log-only
mysql 開發進階篇系列 48 xtrabackup (增量備份與恢復)
一.增量備份概述 xtrabackup 和innobackupex 二個工具都支援增量備份,這意味著能複製自上次備份以來更改的資料。可以在每個完整備份之間執行許多增量備份,因此,您可以設定一個備份過程,例如每週一次完整備份和每天一次增量備份,或者每天一次完整備份和每小時一次增量備份。對於定期自動備份可以在