我知道大部分人在Windows 安裝東西都習慣Next一直按下去
不過很多廣告就是這樣進駐到你電腦裏面的,
但這不是本文重點,
我想說的是最好知道一下自己安裝了什麼
這次要說的是Windows 下的 Appserv
Appserv包含
是的如圖,它包含了四種東西:
Apache伺服器、MySQL資料庫、php支援、管理資料庫的phpMyAdmin

然後Apache與php編輯支援已經在Mac OS X有內建,
也在上一篇文章裡面開啟了他的內建支援,
所以接下來就是安裝 MySQL 資料庫、以及管理資料庫的 phpMyAdmin
你問我為啥這麼麻煩不用套件呢?XAMPP之類還有很多的
我只能說好吧我龜毛,有內建我就要用內建

原本參考到的資料在Mac OS X中配置Apache + PHP + MySQL
看了以後發覺自己手動下載MySQL來安裝還要分別安裝四個東西,相當麻煩
雖然他有附下載MySQL的連接跟說明安裝的鏈接...
http://dev.mysql.com/doc/refman/5.5/en/macosx-installation.html
Installing MySQL on Mac OS X

考慮了一陣子,決定用相關套件管理工具Homebrew來簡化安裝
雖然我個人還滿不愛為了裝什麼得先裝什麼這種做法的,
不過看在Homebrew First Step這篇的主人說他是個電腦潔癖者的份上,結語又說使用上簡單,從過程上看得出來是抓原始碼下來編譯。
加上我原本就要安裝Xcode,
因此必須先安裝Xcode才能安裝Homebrew就不是個問題了,
究竟怎麼安裝Homebrew?
Homebrew 讓 Mac OS X 輕鬆安裝軟體工具又說在安裝 Homebrew 之前,系統必須裝有 ruby 開發工具,一般的 Mac OS X 系統已內建 ruby。(這篇相當值得參考一下)
不過那...Xcode到底要不要裝啊?
Mac 安装 home Brew以及 XCTool的过程记录則說HomeBrew依赖于Xcode的 Command Line Tool

所以如果你從1開始安裝失敗的話,就從 step 0回來安裝Xcode再做吧,
不然就管他去的裝了Xcode再說,還有記得管理者必須有設定密碼,密碼空白是不行的
0.到Mac Store 下載Xcode
1.ctrl+space輸入Terminal打開終端機
2.輸入 ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
3.按照指示輸入密碼、按下Enter安裝
4.跳出安裝Xcode的話還是點下安裝,同意條款、安裝完回到終端機按任意鍵繼續,做完這些步驟Homebrew 就安裝完成了
※整個過程會看到類似底下的東西※
======================================
Last login: Sun Nov 3 11:28:59 on ttys000
AppletekiMac-mini:~ apple$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press ENTER to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir /usr/local
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local
==> Installing the Command Line Tools (expect a GUI popup):
==> /usr/bin/sudo /usr/bin/xcode-select --install
xcode-select: note: install requested for command line developer tools
Press any key when the installation has completed.

==> Downloading and installing Homebrew...


Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.


==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help
AppletekiMac-mini:~ apple$
======================================

5.用剛裝完的Homebrew安裝MySQL,終端機輸入 brew install mysql
======================================
AppletekiMac-mini:~ apple$ brew install mysql
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mysql-5.6.1
######################################################################## 100.0%
==> Pouring mysql-5.6.13.mavericks.bottle.2.tar.gz
==> /usr/local/Cellar/mysql/5.6.13/bin/mysql_install_db --verbose --user=apple -
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
mysql -uroot

To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
==> Summary
🍺 /usr/local/Cellar/mysql/5.6.13: 9382 files, 349M
======================================

6.啓動MySQL:終端機輸入 mysql.server start
======================================
AppletekiMac-mini:~ apple$ mysql.server start
Starting MySQL
. SUCCESS!
======================================

7.測試自己的 mysql root 帳號,終端機輸入 mysql -u root
======================================
AppletekiMac-mini:~ apple$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.13 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
======================================

但是我一直沒研究出MySQL的本體在哪裡、開機是否有自動運行或如何開機自動運行
就要出國了
phpMyAdmin也只能待續......
創作者介紹

Chaneswin's blog & dreams -- 查納斯文.小查的白日夢

Chaneswin 發表在 痞客邦 PIXNET 留言(0) 人氣()