Info

Archive for

前回の続き 「Mac ( Snow Leopard ) に RubyOnRails3 環境構築」でMySQL編です。

1. MySQLインストール
Mac OS X に MySQL をインストール

2. database.xml

development:
  adapter: mysql2
  database: railsdev
  host: localhost
  username: dongrikim
  password: test
  encoding: utf8

3. Gemfile

gem 'mysql2'

4. bundle install

$ bundle install

5. libmysqlclient.18.dylib

$ sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

rvm 使ってた場合:

$ sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Users/dongri/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle 

以上で、設定完了。

エラー編:
1. エラーその1

Gem files will remain installed in /Users/dongrikim/.bundler/tmp/98945/gems/mysql2-0.2.6 for inspection.
Results logged to /Users/dongrikim/.bundler/tmp/98945/gems/mysql2-0.2.6/ext/mysql2/gem_make.out
	from /opt/local/lib/ruby1.9/1.9.1/rubygems/installer.rb:486:in `block in build_extensions'
	from /opt/local/lib/ruby1.9/1.9.1/rubygems/installer.rb:446:in `each'
	from /opt/local/lib/ruby1.9/1.9.1/rubygems/installer.rb:446:in `build_extensions'
	from /opt/local/lib/ruby1.9/1.9.1/rubygems/installer.rb:198:in `install'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/source.rb:96:in `install'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:55:in `block in run'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `block in each'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:44:in `run'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:8:in `install'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/cli.rb:225:in `install'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:in `run'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor.rb:246:in `dispatch'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/base.rb:389:in `start'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/bin/bundle:13:in `'
	from /opt/local/bin/bundle:19:in `load'
	from /opt/local/bin/bundle:19:in `'

解決方法「1. MySQLインストール」 を行う。

2. エラーその2

/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql2-0.2.6/lib/mysql2.rb:7:in `require': dlopen(/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
  Reason: image not found - /opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql2-0.2.6/lib/mysql2.rb:7:in `'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `block in require'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
	from /Users/dongrikim/Dropbox/Developer/Rails/dislike/config/application.rb:7:in `'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in `block in '
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
	from /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in `'
	from script/rails:6:in `require'
	from script/rails:6:in `'

解決方法「5. libmysqlclient.18.dylib」を行う。

無料でDropboxの容量を増やす方法です。
1. Get Started
https://www.dropbox.com/gs(すべて行う)

2. Invite your friends to Dropbox
https://www.dropbox.com/referrals
emailか facebook, twitter に招待URLを乗せる。そのURLで登録されたら +250MB

3. Dropbox Student
https://www.dropbox.com/edu
通常 +250MBから +500MBになります。

4. Dropquest2011
https://www.dropbox.com/dropquest2011
It’s all over…

5. Get extra space free!
https://www.dropbox.com/free (すべて行う)

以上で、無料で増やす方法です。頑張ってみてください w

面倒くさい!と思ったら….

有料でDropboxの容量を増やす方法です。
ブログ管理者にメールして増やしてもらう!
早ければ当日あなたのDropbox容量を18GBにしてあげます。
月単位ではありませんよ。永遠にです。Dropboxサービスが亡くならない限り…
料金: 5000円
メールアドレス: dongrikim@gmail.com

提出:

  1. dropboxアカウントのメールアドレス。
  2. 現在の容量。
  3. 友達を招待URL。(https://www.dropbox.com/referrals ページの http://db.tt/xnSf0Ww のようなURL)
  4. edu認証済みかどうか。(https://www.dropbox.com/edu)

流れ:

  1. 上の提出ものをメールに書いて管理者に申し込む。
  2. 管理者から指定銀行口座を送付
  3. 指定した口座に入金(5000円)
  4. 容量アップ作業開始
  5. お客さんに指定したメールアドレスでedu 認証を行っていただく。(edu認証済みの場合は不要)
  6. 18GBまでアップしたことを確認して完了。