簡體   English   中英

使用MySQL啟動Rails服務器時出錯

[英]Error when starting Rails server with MySQL

我在Windows 7的Ruby 2.0.0上運行Rails 4.0.3,並安裝了DevKit(全部為x64)。 我已經使用subst X: "C:\\Program Files\\MySQL\\MySQL Server 5.6"安裝了mysql2 gem subst X: "C:\\Program Files\\MySQL\\MySQL Server 5.6" ,然后gem install mysql2 --platform=ruby -- --with-mysql-dir=X:並且它已經安裝精細。 然后,我用新的rails new mysql_testy創建了一個新應用,該應用運行良好,但是當我運行rails server ,出現以下錯誤:

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in 'require': 193: %1 is not a valid Win32 application.   - C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2/mysql2.so (LoadError)
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in '<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in 'require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in 'block (2 levels) in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in 'each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in 'block in require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in 'each'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in 'require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler.rb:131:in 'require'
from C:/Users/Liam/Ruby/mysql_testy/config/application.rb:7:in '<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in 'require'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in 'block in <top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in 'tap'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in '<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'`

你們知道發生了什么嗎?

不知道您是否知道了,但是我遇到了同樣的問題。 我安裝了32位sql連接器,從中復制了libmysql.dll文件,並將其粘貼到Ruby / bin文件夾中。 打開一個新的命令提示符,並能夠連接到服務器。

但是,在此步驟之前,您可能必須重新安裝指向連接器路徑的全新MySQL2 gem: gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\\mysql-connector\\mysql-connector-c-6.1.5-win32\\lib" --with-mysql-include="C:\\mysql-connector\\mysql-connector-c-6.1.5-win32\\include" --with-mysql-dir="C:\\mysql-connector"'

希望這可以幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM