MySQL資料庫常用基本命令應用分享02

來源:互聯網
上載者:User

說明:本文來自老男孩linux營運實戰培訓-MySQL資料庫培訓課程系列內容
1)視頻講解目錄
1 MySQL服務作業............................................................................ 3
1.1 啟動與關閉MySQL............................................................. 3
 1.1.1 單一實例方法............................................................ 3
 1.1.2 多執行個體方法............................................................ 4
 1.2 登陸MySQL方法................................................................ 4
 1.2.1 單一實例方法............................................................ 4
 1.2.2 多執行個體方法............................................................ 4
1.3 登陸MySQL後................................................................... 4
1.4 善用MySQL的help........................................................... 5
1.5退出MySQL方法................................................................. 7
1.6設定及修改mysql root使用者密碼...................................... 7
 1.6.1設定密碼方法......................................................... 7
 1.6.2修改root密碼法一................................................. 8
 1.6.3修改root密碼法二................................................. 8
 1.6.4修改root密碼法三................................................. 8
1.7如何找回丟失的mysql root使用者密碼............................... 8
 1.7.1 單一實例啟動方法..................................................... 8
 1.7.2 多執行個體啟動方法..................................................... 8
 1.7.3 修改密碼的方法..................................................... 8
 1.7.4 重啟用新密碼登陸................................................. 9
2 資料庫操作................................................................................. 9
2.1 建立資料庫...................................................................... 9
2.2顯示資料庫...................................................................... 11
2.3 刪除資料庫..................................................................... 12
2.4 串連資料庫..................................................................... 12
2.5 查看當前串連的資料庫................................................... 13
2.6 當前資料庫包含的表資訊................................................ 14
2.7 刪除系統多餘帳號.......................................................... 14
2.8 建立使用者並賦予許可權兩法................................................ 15
 2.8.1 查看grant協助................................................... 15
 2.8.1 create和grant配合法........................................ 16
 2.8.2 直接grant法....................................................... 18
 2.8.3 通過實驗獲得ALL PRIVILEGES包括哪些許可權........ 19
 2.8.4 生產環境授權使用者的建議..................................... 20
2.9查看mysql的使用者........................................................... 23
3 表操作...................................................................................... 23
3.1準備................................................................................ 23
3.2建表................................................................................ 24
 3.2.1 建立測試表test.................................................. 24
 3.2.2 生產環境標準的UTF8格式表結構語句.................. 25
  3.2.2.1 mysql欄位類型............................................. 25
  3.2.2.2 建立幾個關聯表:....................................... 26
  3.2.2.3 建立關聯表語句........................................... 26
  3.2.2.4 某sns產品生產正式建表語句....................... 27
3.3 查表結構及建表的SQL.................................................... 27
 3.3.1 查看錶結構.......................................................... 27
 3.3.2 查看建表語句....................................................... 28
 3.3.3 為欄位建立索引................................................... 28
3.4插入資料......................................................................... 31
3.5 查詢............................................................................... 34
 3.5.1 查詢所有行............................................................ 34
 3.5.2 查詢前幾行資料..................................................... 34
 3.5.3 多表查詢............................................................... 37
 3.5.4 使用explain查詢select語句使用索引情況.............. 37
3.6 修改表中資料................................................................. 38
3.7 刪除表中資料................................................................. 39
3.8 在表中增刪改欄位(dba操作).......................................... 41
3.9 更改表名........................................................................ 43
3.10 刪除表.......................................................................... 45
3.11 mysql欄位類型............................................................. 45
4 MySQL資料庫的備份與恢複........................................................ 45
4.1 準備工作:首先建表填充資料......................................... 45
4.2 填充中文資料暴漏亂碼問題............................................ 46
4.3 MySQL字元集介紹........................................................... 50
4.4 set names gbk在做什嗎?............................................. 52
4.5備份單個資料庫............................................................... 57
4.6 mysqldump在做什嗎?.................................................... 59
4.7備份多個庫...................................................................... 61
4.8備份單個表...................................................................... 61
4.9備份多個表...................................................................... 62
4.10備份資料庫結構(不包含資料)........................................ 63
5恢複資料庫................................................................................ 64
5.1 source命令恢複............................................................. 64
5.2 mysql命令恢複(標準).................................................... 70
6 mysql帶-e參數實現非互動式對話............................................... 72
6.1 恢複mysql資料.............................................................. 72
6.2 查看mysql狀態.............................................................. 73
7 mysql生產環境案例.................................................................... 76
7.1 mysql資料庫批量插入資料shell指令碼實現..................... 76
7.2 不登陸資料庫執行mysql命令小結.................................. 77

2)視頻實戰講解(全屏觀看效果更好)

 


 相關視頻內容請博友們多多關注老男孩的部落格更新。
最後,歡迎大家一起探討學習和教學,如何讓學習者有所收穫,讓從師者如何最大限度的把知識進行最大限度的傳承。

本文出自 “老男孩linux營運” 部落格,請務必保留此出處http://oldboy.blog.51cto.com/2561410/1130667

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.