mysql - Can't install mysql2 for rails 3 on Windows -


can't install mysql2 without error message. i've tried every way can think of including using devkit.

gem install mysql2 -- --with-mysql-include=c:/xampp/mysql/inclu de --with-mysql-lib=c:/xampp/mysql/lib --with-mysql-config=c:/xampp/mysql/bin/my sql_config  temporarily enhancing path include devkit... building native extensions.  take while... error:  error installing mysql2:         error: failed build gem native extension.  c:/railsinstaller/ruby192/bin/ruby.exe extconf.rb --with-mysql-include=c:/xampp/ mysql/include --with-mysql-lib=c:/xampp/mysql/lib --with-mysql-config=c:/xampp/m ysql/bin/mysql_config checking rb_thread_blocking_region()... yes checking main() in -llibmysql... no *** extconf.rb failed *** 

make sure library points /lib/opt , not /lib

using mysql rails 3 on windows

  • install railsinstaller -> www.railsinstaller.org (i installed c:\rails)

  • install mysql (i used mysql 5.5) -> dev.mysql.com/downloads/installer/

--- mysql installation ---

if dont have these 2 files installed might need them mysql going

vcredist_x86.exe -> http://www.microsoft.com/download/en/details.aspx?id=5555 dotnetfx40_full_x86_x64.exe -> http://www.microsoft.com/download/en/details.aspx?id=17718

use default install developer machine

-mysql server config-
port: 3306
windows service name: mysql55
mysql root pass: root (you can change later)
(username: root)
-mysql server config-

--- mysql installation ---


--- install mysql2 gem ---

important: do git bash command line(this installed railsinstaller) -> start/git bash

gem install mysql2 -- '--with-mysql-lib="c:\program files\mysql\mysql server 5.5\lib" --with-mysql-include="c:\program files\mysql\mysql server 5.5\include"'

gem should have installed correctly

lastly copy libmysql.dll file from
c:\program files\mysql\mysql server 5.5\lib
to
c:\rails\ruby1.9.2\bin

--- install mysql2 gem ---


you able use rails app mysql, if not sure how create rails 3 app mysql read on...


--- rails 3 app going mysql ---

open command prompt(not git bash) -> start/cmd
navigate folder (c:\sites)
create new rails app

rails new world 

delete file c:\sites\world\public\index.html
edit file c:\sites\world\config\routes.rb
add line -> root :to => 'cities#index'

open command prompt (generate views , controllers)

rails generate scaffold city id:integer name:string countrycode:string district:string population:integer 



edit file c:\sites\world\app\models\city.rb this

class city < activerecord::base  set_table_name "city" end 

edit file c:\sites\world\config\database.yml this

development: adapter: mysql2 encoding: utf8 database: world pool: 5 username: root password: root socket: /tmp/mysql.sock 

open command prompt windows cmd, not git bash(run app!)
navigate app folder (c:\sites\world)

rails s 

open browser here -> http://localhost:3000

--- rails 3 app going mysql ---


Comments