I'm very new to Ruby on Rails, and have been getting the following error every time I run:
rails s
I get the following error:
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_get_client_info
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
Trace/BPT trap
I've done quite a bit of research on this on StackOverflow and good ol' Google, and have tried the solutions on this post: rails server error ? (rails 3) with editing the .profile file, as well as ensuring that mysql and ruby are were both installed for 64-bit systems.
I'm running on OSX Snow Leopard, using Rails 3.0.9 and Ruby 1.8.7.
Any help would be greatly appreciated!! Thank you! :)
To run Rails 3 you need ruby 1.9.2. I would start there before going any further, please check this link out, your best bet is to use rvm to manage your ruby version. Regards
http://amerine.net/2010/02/24/rvm-rails3-ruby-1-9-2-setup.html
Related
I have created new ruby on rails project with mysql database.
I have run mysql server by running mysql.server start
When I try to run rake db:create, I got following error:
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
Expected in: flat namespace
Anybody can solve this issue?
Please reachout me. Regards.
The salient details are that you need to update the DYLD_LIBRARY_PATH to include /usr/local/mysql/lib. The easiest way of doing that is to add the following to your ~/.bashrc file:
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
I went into a little more detail in a blog post here: http://www.bartbusschots.ie/blog/?p=2186
I'm using JRuby 1.7.2, along with DataMapper, and I'm getting an error I can't find an answer to.
I'm just testing out DataMapper along with MySQL 5.5 to see if it will run fine when I build around it. Here's the file I'm testing:
require "data_mapper"
require "keys"
DataMapper.setup(:default, "mysql://#{$user}:#{$pass}#localhost/test_db")
And when I run this, I get the error:
NameError: cannot load Java class com.mysql.jdbc.Driver
And it points to the DataMapper.setup line.
My Gemfile should be alright:
source :rubygems
gem "sinatra"
gem "trinidad"
gem "data_mapper"
# do a `sudo apt-get install libmysqlclient-dev` first
gem "dm-mysql-adapter"
gem "jdbc-mysql"
Is there anything I'm missing? I have MySQL set up with a user/pass locally already.
This is a common error when running JDBC clients for MySQL. You need to make sure you have mysql-connector-java-bin.jar on the classpath. You can download it from here.
I'm using Rails 3.2.9 and to solve the problem I added this to my application.rb
if defined? JRUBY_VERSION
require 'jdbc/mysql'
Jdbc::MySQL.load_driver
end
actually, the correct answer is to work-around an incompatibility between 5.1.13 and 5.1.22 !
jdbc-mysql gem already contains the mysql-connector.jar it just ain't auto-loading anymore :
https://github.com/jruby/activerecord-jdbc-adapter/tree/master/jdbc-mysql (read the README)
you can also force the driver to auto-load using a Java system property e.g. from a cmd line :
jruby -J-Darjdbc.mysql.autoload=true -S rake ...
I had the same error when trying to use a mysql database from jruby/rails4. In my case this line was missing from ./Gemfile:
gem 'jdbc-mysql'
In our JRuby/Rails project, we are using the i18n gem, and support Japanese as well as English. Our config/locales.ja.yml file is in UTF-8, without any BOM.
When running Rails 3.2.9 on JRuby 1.7.1, we now see the following error:
% jruby -S rake spec:models
Psych::SyntaxError: (C:/Projects/foobar/trunk/config/locales/ja.yml):
expected <block end>, but found Scalar while parsing a block
mapping at line 7 column 33
parse at org/jruby/ext/psych/PsychParser.java:213
...
This error for YAML parsing the ja.yml file is now happening on both our Windows XP and Linux development environments, and only seems to go away when we explicitly set the following system parameter for the JVM:
-Dfile.encoding=utf-8
Could anyone tell me why this is happening on JRuby 1.7.1?
I didn't see this in 1.6.8 or 1.7.0.
Over a year old now, but here is the answer:
http://jruby.org/2012/12/03/jruby-1-7-1.html
In that release, this happened:
Psych YAML engine updated to latest
I'm running mac OS X Snow Leopard and I recognize that this is a common problem.
I have installed and reinstalled both the 32- and 64-bit binary installations of MySQL.
That didn't work, so I went ahead and (against my common sense) installed perl5 through macports to have an entirely different perl than the version that ships with Snow Leopard.
I re-installed DBI and DBD::mysql modules into the new perl, both with success.
And yet still:
me$ perl5 processmail
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /opt/local/lib/perl5/site_perl/5.8.9/darwin- 2level/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup
dyld: Symbol not found: _mysql_init
Referenced from: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/auto/DBD/mysql/mysql.bundle
Expected in: dynamic lookup
I have also tried perl5 processmail --mysql_config=/usr/local/mysql/bin/mysql_config.
Thanks in advance
Do you get the same error running your perl script as root?
Does your shell environment possibly have VERSIONER_PERL_PREFER_32_BIT=no set?
there's more info about both of these at http://www.perlmonks.org/?node_id=793727
I just finally solved this on our box by getting rid of the default setting
defaults delete com.apple.versioner.perl
Suddenly it just works! Whatever
I'm trying to get the mysql gem working on OSX 10.5.6, and feeling stymied.
% gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql-2.7
1 gem installed
% irb -rubygems -rmysql
irb> Mysql.init
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Users/rampion/.gem/gems/mysql-2.7/lib/mysql.bundle
Expected in: dynamic lookup
dyld: Symbol not found: _mysql_init
Referenced from: /Users/rampion/.gem/gems/mysql-2.7/lib/mysql.bundle
Expected in: dynamic lookup
zsh: trace trap irb -rubygems -rmysql
%
I'm using the default install of ruby 1.8.6.
I'm using a 64-bit version of MySQL 5.0.77. mysqld is running and I can use the mysql shell, so I suspect my issue is with mysql.gem, though I'm by no means certain.
Can anyone offer any advice?
Ok. So the solution turned out to be I needed to be runing the 32-bit version of MySQL 5.0.77 in order for mysql.gem to work.