Last Updated on 2021-05-13 by Clay
最近進行了一些關於資料庫的學習,了解到了在資料庫的世界中,大致上分成以下三層:
- 資料庫 (Database, DB)
- 資料庫管理系統 (Database Management System, DBMS)
- 應用程式 (Application)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-114.png?resize=868%2C454&ssl=1)
『資料庫』(Database)本身為收集著各種我們貯存資料的地方,我們可以透過『資料庫管理系統』(Database Management System)來進行查詢、插入、更新、刪除 ...... 等等的操作。
而『應用程式』(Application)則是我們將資料庫建立好之後,供使用者進行查詢的前端。
那麼以下,開始介紹如何安裝 MySQL 這個相當著名的資料庫。
安裝 MySQL
首先,我們進入下載 MySQL 的網站:https://dev.mysql.com/downloads/mysql/
- 選擇你的作業系統,這裡我以 Windows 示範
- 進入下載頁面
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-82.png?fit=840%2C679&ssl=1)
注意這裡有分成 web 版跟一般版,選擇一般版即可。
![](https://i2.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-83.png?fit=840%2C573&ssl=1)
不用註冊也可以。選擇後,便會開始下載。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-84.png?resize=876%2C671&ssl=1)
MySQL Workbench
這是我們可以操作 MySQL 的應用程式,新版的話在安裝上方我們下載的 MySQL 時似乎會自動安裝,可以跳過這個步驟,直接到下方【安裝 MySQL】的部份繼續執行。
當然,你還是可以參考這裡的下載方式,下載 MySQL Workbench。
首先,同樣來到 MySQL Workbench 的下載位置。https://www.mysql.com/products/workbench/
選擇中央的 Download Now 按鈕進行下載。
![](https://i2.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-87.png?fit=840%2C404&ssl=1)
同樣選擇作業系統、然後下載。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-86.png?resize=1025%2C839&ssl=1)
同樣,並不是一定得註冊或登入才可以下載。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-88.png?resize=839%2C683&ssl=1)
安裝 MySQL
點擊安裝剛才下載的 MySQL 安裝檔。步驟可能會有點多,不過安裝的速度還算快。
如果我有跳步驟沒截到圖的部份,其實直接一直選擇下一項即可,預設的安裝通常都是最輕量化、最沒有額外套件的。唯一重要的是一定要把 Root 的密碼設定好。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-89.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-90.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-91.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-92.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-93.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-94.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-95.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-96.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-97.png?resize=982%2C741&ssl=1)
這裡相當重要,要設定一個不會忘記的密碼,最好是高強度密碼。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-98.png?resize=982%2C741&ssl=1)
替這個 Server 取名。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-99.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-100.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-101.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-102.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-103.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-104.png?resize=982%2C741&ssl=1)
這裡可以再次輸入剛才設定好的 Root 密碼,可以查看是否輸入成功。完成之後再次選擇 Next。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-105.png?resize=982%2C741&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-106.png?resize=982%2C741&ssl=1)
率先跳出的是 MySQL 的 Command Line,可以關閉,只操作 MySQL Workbench 即可。
![](https://i2.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-107.png?fit=840%2C486&ssl=1)
會自動安裝的情況下(或你電腦裡本來就裝好了),會自動跳出這個界面;如果沒有跳出這個界面,可以回到上一小節手動安裝 MySQL Workbench。
![](https://i2.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-108.png?fit=840%2C473&ssl=1)
選擇這個我們剛配置好的 MySQL 資料庫。
![](https://i1.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-110.png?fit=840%2C473&ssl=1)
剛才設定好的密碼現在就要輸入了。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-111.png?resize=517%2C272&ssl=1)
至 query 1 寫下 show databases; 指令。
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-112.png?fit=840%2C473&ssl=1)
![](https://i0.wp.com/clay-atlas.com/wp-content/uploads/2019/11/image-113.png?resize=668%2C643&ssl=1)
如果能看到顯示結果(你的結果可能會跟我不一樣),那代表我們的資料庫設定好了。
I’m really inspired along with your writing abilities as
neatly as with the format on your blog. Is this a paid theme or did you customize it your self?
Anyway keep up the nice quality writing, it
is uncommon to look a nice weblog like this one nowadays..
Amazing issues here. I am very happy to peer your post.
Thanks a lot and I’m having a look ahead to contact you. Will you kindly drop
me a e-mail?
我用了custom setup type. MySQL server 在安裝後是通過了configuration, 甚麼問題都沒有。但我打開MySQL installer 卻顯示server 要reconfigure。嘗試很多次也沒有成功。我嘗試過所有東西重新安裝都沒用。
抱歉…我也不太清楚會是什麼樣的問題。
有查詢過網路上有人有一樣的報錯嗎?
感謝您的教學。:)
如果有幫上忙就好。