作者catjimmy (cat)
看板Ruby
标题[问题] 新手在Mac OSX 10.6.7上安装问题
时间Sat Jun 4 19:51:18 2011
我主要参考了以下几篇作为安装教学指引
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