このウィキの読者になる
更新情報がメールで届きます。
このウィキの読者になる
カテゴリー
最近更新したページ
最新コメント
Synergy by stunning seo guys
RedHat9でyum by stunning seo guys
MRTG by stunning seo guys
rpmbuild by stunning seo guys
WevDAV by awesome things!
ubuntuメモ by check it out
mingplotの導入 by check it out
ServerIron設定メモ by awesome things!
mount by stunning seo guys
FrontPage by check it out
Menu
ここは自由に編集できるエリアです。

RubyOnRailsメモ

トラブル No such file or directory - /tmp/mysql.sock


# ruby script/generate scaffold Product Admin
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/admin
      exists  test/functional/
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/product.rb
      create    test/unit/product_test.rb
      create    test/fixtures/products.yml
No such file or directory - /tmp/mysql.sock

原因

MySQL接続に使用するソケットが見つからない。

解決方法

MySQLのソケットの場所を確認する。
# mysqladmin -p version
Enter password:
mysqladmin  Ver 8.41 Distrib 5.0.27, for redhat-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          5.0.27
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 32 min 25 sec

Threads: 1  Questions: 51  Slow queries: 0  Opens: 19  Flush tables: 1  Open tables: 6  Queries per second avg: 0.026

/var/lib/mysql/mysql.sockということを確認。
config/database.ymlにMySQLのソケットの位置を指定。

development:
test:
production:
の各行の一番下にでも以下の行を挿入。
socket: /var/lib/mysql/mysql.sock


トラブル Access denied for user 'root'@'localhost' (using password: NO)# ruby script/generate scaffold Product Admin

      exists  app/controllers/
      exists  app/helpers/
      exists  app/views/admin
      exists  test/functional/
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
   identical    app/models/product.rb
   identical    test/unit/product_test.rb
   identical    test/fixtures/products.yml
Access denied for user 'root'@'localhost' (using password: NO)

原因

MySQLにrootパスワードなしで接続しようとして怒られる。

解決方法?

config/database.yml の password: の項目にrootパスワードを設定する。

セキュリティ上あまりよろしくない気がするが・・・。


トラブル rails1.2.2 -> 1.2.3 update後

新しく作ったrailsファイル郡に対してWEBrickを起動するとエラーが起こる

# ruby script/server
./script/../config/boot.rb:29: undefined method `gem' for main:Object (NoMethodError)
        from /usr/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__'
        from /usr/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
        from script/server:2

何かupdateの時に失敗したのかもしれないが、、、
以前のバージョンの時に作ったboot.rbファイルとの差分を取って、29行目を書き換えてみた。

        gem "rails", "=#{rails_gem.version.version}"
    ↓修正後
        require_gem "rails", "=#{version}"

よく分からないが動いた。
2007年09月23日(日) 20:21:15 Modified by glass57




スマートフォン版で見る