Saturday, March 12, 2011

Re: [Rails] mysql2 adapter unable to connect to MySQL

On Sat, Mar 12, 2011 at 8:11 AM, Ajay <stealthu471@gmail.com> wrote:
Hello,

When I am running the command "rails server", I am getting the
following error
/usr/local/bin/ruby: symbol lookup error: /usr/local/lib/ruby/gems/
1.9.1/gems/gems/mysql2-0.2.6/lib/mysql2/mysql2.so: undefined symbol:
RARRAY_LEN

Earlier, I got exactly the same error, when was I executing the
command
rake db:bootstrap
It got solved when I modified the command to the following
rake db:bootstrap --with-mysql-config=/usr/local/bin/mysql_config

I am understanding from the above that mysql2 adapter was not able to
find MySQL, which it was able to after passing the argument. Thinking
in those lines, I executed the following commands

rails server --with-mysql-config=/usr/local/bin/mysql_config
But, it does not solve it rails does not take that argument

I then put the parameter
--with-mysql-config=/usr/local/bin/mysql_config
in a configuration file and executed
rails server --config=configFileMysql

I am getting the following message
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/
active_support/dependencies.rb:239:in `require': no such file to load
-- ./configFileMysql (LoadError)

I also want to mention that I am running "rails server" command to run
spreecommerce 0.40.3 package.

Could anyone please help me as to how to solve the error I pointed out
earlier regarding RARRAY_LEN

I have the following content in my database.yml

development:
 adapter: mysql2
 encoding: utf8
 reconnect: false
 database: fourth_development
 pool: 5
 username: root
 password:
 socket: /var/lib/mysql/mysql.sock

I also want to mention that mysql client did not work earlier and it
was giving following error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2)
I had to change the command from
"mysql" to
mysql --user=root --password --socket=/var/lib/mysql/mysql.sock
in order to make it work
and also add
in my /etc/my.cnf file,  I had to change it to
[client]
socket: /var/lib/mysql/mysql.sock

On my Fedora 14 OS, I have the following installed
Rails 3.0.5, installed at
 /usr/local/bin/rails

ruby --version
gives me
ruby 1.9.2p0 (2010-08-18) [i686-linux]
 whereis ruby
gives me
ruby: /usr/lib/ruby /usr/local/bin/ruby /usr/local/lib/ruby

mysql  Ver 14.14 Distrib 5.1.51, for pc-linux-gnu (i686) using
EditLine wrapper

/etc/rc.d/init.d/mysql status
MySQL running (28105)                                      [  OK  ]



Hi Ajay,

Have you tried uninstalling mysql2 gem and reinstalling it with the following command?

gem install mysql2 -- --with-mysql-config=/usr/local/bin/mysql_config

B.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate