顯示具有 MySQL 標籤的文章。 顯示所有文章
顯示具有 MySQL 標籤的文章。 顯示所有文章

2015年9月16日 星期三

Mac安裝PostgreSQL與簡單教學

PostgreSQL和MySQL一樣都是一種SQL Server
以下有些教學是可以提供給會MySQL,也想使用PostgreSQL的使用者看看

第零步,安裝PostgreSQL

使用brew來安裝 (Linux的話就看是apt / yum 還是什麼的,以下以Mac為例)

brew install postgresql

成功的話,會看到最後有段訊息

To have launchd start postgresql at login:
  ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Or, if you don't want/need launchctl, you can just run:
  postgres -D /usr/local/var/postgres


主要的重點是說,你想要一登入Mac的使用者,就自動啟動PostgreSQL的話,就在終端機輸入


ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents

要手動啟動 (第一次裝完最好也輸入一次)

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

如果想要停止的話輸入

postgres -D /usr/local/var/postgres




第一步,建立Database
createdb 是 postgresql 建立資料庫的指令

2015年9月1日 星期二

Ruby on Rails 連結MAMP的MySQL教學 (Mac適用)


Mac要先安裝Mysql (透過brew),指令如下:

brew install mysql

再來是到Rails中安裝mysql的gem,進到目錄下編輯Gemfile,加入這行

gem 'mysql2'

然後

bundle install

可以先到MAMP的phpMyAdmin建立好一個資料庫和User來使用
(MAMP預設的phpMyAdmin位置是 http://localhost:8888/phpMyAdmin/ )

參考以下步驟

2015年8月27日 星期四

Mac之簡單PHP教學入門(使用MAMP與Eclipse PDT)





1. 至Eclipse官網下載PHP PDT (PHP Development Tools)版的Eclipse

2. 下載MAMP,這邊用的是Free版

3. 解壓縮Eclipse (沒有裝過JRE的可能在這時候會需要安裝)

4. 安裝MAMP

5. MAMP裝好後,在Mac的Launchpad就會看到MAMP和MAMP Pro,使用MAMP就好
開啟後還會再問一次,一樣選MAMP就好
(因為這邊只是練習和測試,所以使用只有本機連線功能的MAMP就好)