Mac配置MySQL+php+phpmyadmin+Tomcat+Eclipse
一袋马、MySQL
1. 下載地址:http://www.mysql.com/downloads/mysql
2. 安裝,最后彈出的對(duì)話框要記住臨時(shí)密碼秸应,譬如我的:
root@localhost: ?MYHu,d?8Qd;
3. 終端登錄MySQL
1) 打開(kāi)終端虑凛,輸入絕對(duì)路徑
/usr/local/mysql/bin/mysql -u root -p
2)輸入相對(duì)路徑
echo $PATH
PATH="$PATH":/usr/local/mysql/bin
mysql -u root -p
4. 重置MySQL初始密碼(因?yàn)槲依鲜禽敳粚?duì)……)
1)關(guān)閉“系統(tǒng)偏好設(shè)置”里的MySQL
2)禁止mysql驗(yàn)證功能
打開(kāi)終端輸入:
cd /user/local/mysql/bin/
sudo su? ? #登錄管理員權(quán)限sudo
./mysqld_safe --skip-grant-tables & #禁止mysql驗(yàn)證功能
之后『偏好設(shè)置』中的MySQL狀態(tài)變成running
3)運(yùn)行
打開(kāi)終端,輸入:
./mysql
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY '*';
5. 設(shè)置數(shù)據(jù)庫(kù)默認(rèn)字符集
打開(kāi)終端软啼,輸入:
mysql -u root -p
create database mydb; ?#創(chuàng)建數(shù)據(jù)課mydb
alter database mydb default character set = utf8;
二桑谍、php
終端輸入:
sudo apachectl restart
出現(xiàn)it works!網(wǎng)頁(yè)即可
以上用的是OS X自帶php,如果要更新到7.0或7.1祸挪,終端輸入:
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
三锣披、phpmyadmin
1. 下載地址:http://www.phpmyadmin.net/home_page/downloads.php
2. 將下載下來(lái)的解壓放在/Library/WebServer/Documents/目錄下,并且重命名為phpmyadmin
3. 修改
打開(kāi)終端贿条,輸入:
cd /Library/WebServer/Documents/phpmyadmin/
cp config.sample.inc.php config.inc.php
vim config.inc.php
做修改如下:
$cfg['blowfish_secret'] = '';//用于Cookie加密雹仿,隨意的長(zhǎng)字符串
$cfg['Servers'][$i]['host'] = '127.0.0.1';//MySQL守護(hù)程序做了IP綁定
四、Tomcat
1. 解壓后命名為T(mén)omcat放在/Library
cd /Library/Tomcat/bin/*.sh
2. Eclipse配置
打開(kāi)下載好的eclipse jee整以,上方菜單選擇:Windows->show views->Others...->Servers
選擇tomcat的路徑
五胧辽、其他
1. Eclipse服務(wù)器占用問(wèn)題:
出現(xiàn)提示:Problem: Several ports (8005, 8080, 8009) required by Tomcat v6.0 Server at localhost are already in use. ..
打開(kāi)終端,輸入:
kill $(ps -aef | grep java | grep apache | awk '{print $2}')