Hi Bryan,
I executed the symlink command you sent me and then executed
rails server
But, I am still getting the same 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
In addition, I have done the following experiments
rails new blog -d=mysql
cd blog
su bundle install
rake db:create
rails server
The above set of instructions are rails instructions for getting
started on rails. With these instructions, rails server starts well at
the following URL
http://0.0.0.0:3000
For the above set of instructions, I have the following lines in my
GemFile
gem ‘rails’, ‘3.0.5’
gem ‘mysql2’
In my config/database.yml, I have
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: blog_development
pool: 5
username: root
password:
socket: /tmp/mysql.sock
I tried having
socket: /var/lib/mysql/mysql.lock
with the symbol link and without it. It does not seem to make any
difference.
With the spree package that I am trying to run, I have the following
content in my Gemfile
gem ‘rails’, ‘3.0.5’
Bundle edge Rails instead:
gem ‘rails’, :git => ‘git://github.com/rails/rails.git’
gem ‘mysql2’
gem ‘newrelic_rpm’
Followed by spree itself first, all spree-specific extensions second
gem ‘spree’, ‘0.40.3’
gem ‘spree_active_shipping’, :git => ‘https://github.com/spree/
spree_active_shipping.git’
gem ‘spree_product_assembly’, :git => ‘git://github.com/spree/spree-
product-assembly.git’
gem ‘spree_static_content’, :git => ‘git://github.com/spree/
spree_static_content.git’
I executed the following set of commands
rails new xyz -d=mysql
cd xyz
su bundle install
rake db:create
rails g spree:site
rake spree:install
rake spree_sample:install
rails server --config=/usr/local/bin/mysql_config
Above are the instructions given for spree at the URL,
http://spreecommerce.com/documentation/getting_started.html
config/database.yml is same as previously mentioned
Now executing,
rails server
gives
/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
Question is my why two different results? Is it because in one of the
case, mysql connection is not needed as no information is there in the
tables?
Also, I had tried downgrading rails to 3.0.4 and then executing the
above set of instructions. But, same error
I read in the following post
http://www.linuxforums.org/forum/red-hat-fedora-linux/31155-error-2002-hy000-cant-connect-local-mysql-server.html
that adding host name resolves the issue
Therefore, I tried different options like
host = starwars.localdomain
host = starwars
in /etc/my.cnf
But, when I do that I am unable to restart my MySQL server as it says
that PID file has not been written to (or unable to write).
Therefore, I am unable to mention
host=0.0.0.0, which where rails server is getting started
I get similar error of unable to start mysql server, when I have
socket=/tmp/mysql.sock
in /etc/my.cnf
Thinking that linking was not allowed, I even tried disabling the
following line in /etc/my.cnf
symbolic-links=0
But, again server does not start, whenever I change anything in /etc/
my.cnf
My present my.cnf content is as follows
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
#socket=/tmp/mysql.sock
user=mysql
Disabling symbolic-links is recommended to prevent assorted security
risks
symbolic-links=0
#host=starwars
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
socket=/var/lib/mysql/mysql.sock
#socket=/tmp/mysql.sock
#host=starwars.localdomain
In one situation, which I can still reproduce, I am getting the
following error, when I running as non-root
=> Booting WEBrick
=> Rails 3.0.4 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/local/lib/ruby/gems/1.9.1/gems/gems/rack-1.2.2/lib/rack/server.rb:
267:in initialize': Permission denied - /home/Ajay/spree/rails4store/ tmp/pids/server.pid (Errno::EACCES) from /usr/local/lib/ruby/gems/1.9.1/gems/gems/rack-1.2.2/lib/rack/ server.rb:267:in
open’
from /usr/local/lib/ruby/gems/1.9.1/gems/gems/rack-1.2.2/lib/rack/
server.rb:267:in write_pid' from /usr/local/lib/ruby/gems/1.9.1/gems/gems/rack-1.2.2/lib/rack/ server.rb:203:in
start’
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.4/lib/rails/
commands/server.rb:65:in start' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.4/lib/rails/ commands.rb:30:in
block in <top (required)>’
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.4/lib/rails/
commands.rb:27:in tap' from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.4/lib/rails/ commands.rb:27:in
<top (required)>’
from script/rails:6:in require' from script/rails:6:in
’
Thinking that probably I need to run as root, I executed as root
It then gives the usual mysql2 error that I mentioned earlier. I
thought of mentioning it to you in case you have seen this error
before.
Please let me know if I am missing something or any other ideas that
you have, which I can try out.
Thanks a lot for your help,
Ajay