[問題] 新手在Mac OSX 10.6.7上安裝問題
我主要參考了以下幾篇作為安裝教學指引
XDite:Best Practice of installing Ruby on Rails on clean Mac
http://blog.xdite.net/?p=2063
ihower:Ruby on Rails實戰聖經
http://ihower.tw/rails3/installation.html
以及很多在stackoverflow.com上面的文章
主要在安裝mysql的地方遇到了很多問題,我盡量把我的安裝過程及遇到的情況描述清楚
有些問題看起來好像我已經解決了,事實上我不太明白為什麼這樣可以解決
所以可以的話也請不吝解釋一下(跪
因此文章很長,但懇請幫我解惑,我撞牆撞好幾天了Orz
-----------------------------------以下開始過程-------------------------------
一開始我使用brew install mysql來安裝mysql,安裝完後
unset TMPDIR
mysql_install_db <=這裡會出現以下錯誤(問題一)
FATAL ERROR: Could not find ./bin/my_print_defaults
因此我將mysql_install_db改為安裝時系統提示的
mysql_install_db --verbose --user=`whoami` \
--basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql \
--tmpdir=/tmp
就可以安裝了,接下來再執行
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
跳出了com.mysql.mysqld: Already loaded錯誤
我就將這玩意兒先unload掉...(事實上若它已經load我應該不用管它是吧?)
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
就可以執行那段load了
再來執行/usr/local/Cellar/mysql/5.5.10/bin/mysql_secure_installation
照著指示可以順利安裝,然後接著把RVM REE都安裝好
我中間試著想安裝1.9.2的ruby時,使用rvm instal 1.9.2的指令無法安裝
出現以下的錯誤訊息:
ERROR: Error running 'make ', please read /Users/mary/.rvm/log/ruby-1.9.2-p180/make.log
ERROR: There has been an error while running make. Halting the installation.
我照著人家的指示自己重新下載編譯Readline(事實上在此之前我根本還沒裝Readline)
curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.1.tar.gz
tar xzvf readline-6.1.tar.gz
cd readline-6.1
./configure --prefix=/usr/local
make
sudo make install
cd ..
rvm remove 1.9.2
rvm install 1.9.2 -C --enable-shared,--with-readline-dir=/usr/local
這樣就可以順利安裝1.9.2了,但為什麼沒辦法像書上或是ihower網頁上直接
rvm install 1.9.2來安裝呢?(問題二)
接著繼續照著XDite的說明繼續安裝其他的Ruby Gems,設定網頁伺服器
安裝passenger,修改httpd.conf,開啟virtuall host,重開apache後
我就打算來測試我的ror,主要是參考ruby guides上面的指示
http://guides.ruby.tw/rails3/getting_started.html
cd ~/.work
rails new blog -d mysql
cd blog
bundle install
sudo vim config/database.yml修改以下mysql資訊
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: blog_development
pool: 5
username: root
password:e04su3su;6
socket: /tmp/mysql.sock
接著rake db:create....馬上跳出以下錯誤
WARNING: This version of mysql2 (0.3.2) doesn't ship with the ActiveRecord
adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
WARNING: Global access to Rake DSL methods is deprecated. Please Include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Blog::Application#task called at /Users/apple/.rvm/gems/
ree-1.8.7-2011.03/gems/railties-3.0.7/lib/rails/application.rb:215:in
`initialize_tasks'
rake aborted!
syntax error on line 15, col 2: ` socket: /tmp/mysql.sock'
看起來像是mysql2的版本跟我的rails感情不是很好...
google後找到一個解法是這樣...
sudo gem install mysql2-0.2.7
sudo vim Gemfile
加上 gem 'mysql2', '0.2.7'
然後再rake db:create後變成這個錯誤...
WARNING: Global access to Rake DSL methods is deprecated. Please Include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Blog::Application#task called at /Users/apple/.rvm/gems
/ree-1.8.7-2011.03/gems/railties-3.0.7/lib/rails/application.rb:215:in
`initialize_tasks'
rake aborted!
syntax error on line 15, col 2: ` socket: /tmp/mysql.sock'
Tasks: TOP => db:create => db:load_config
(See full trace by running task with --trace)
發現是config.database.yml裡的password:後面要空一格才能接密碼,修改存檔後
重新rake db:create...發現他開始瘋狂的給我
Access denied for user 'root'@'localhost' (using password: YES)
然後不論是mysql -uroot,mysql -u root -p都一直給我deny
繼續google發現人家說必須安裝64位元的mysql,但我裝不起來!!!!
真的是這樣的方法嗎orz...
請高手指點一下....我到底要怎麼把這個mysql弄好咧...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.245.112.157
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 4 篇):
Ruby 近期熱門文章
PTT數位生活區 即時熱門文章