Mysql connection issue with passenger

235 views
Skip to first unread message

kunwar

unread,
Sep 25, 2009, 9:05:30 AM9/25/09
to Phusion Passenger Discussions
Hi,
I have tried passenger with ruby 1.9 but not able to make it, so now
tried with ruby-enterprise.
I have same issue with both and my current environment is with ruby-
enterprise.
Environment:
1. Rails 2.3.4
2. gem 1.3.5
3. yum list |grep "httpd"
httpd.x86_64 2.2.3-22.el5.centos.2
installed
httpd-devel.x86_64 2.2.3-22.el5.centos.2
installed
httpd-devel.i386 2.2.3-22.el5.centos.2
installed
httpd-manual.x86_64 2.2.3-22.el5.centos.2
installed
system-config-httpd.noarch 5:1.3.3.1-1.el5
installed
system-config-httpd.noarch 5:1.3.3.3-1.el5
base
4. MySQL 5.1.37 Community Server (GPL)
5. gem list

*** LOCAL GEMS ***

actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
fastthread (1.0.7)
mysql (2.8.1)
passenger (2.2.5)
rack (1.0.0)
rails (2.3.4)
rake (0.8.7)
rubygems-update (1.3.5)
6. ls -l (inside /opt/ruby-enterprise/bin)
total 2764
-rwxr-xr-x 1 root root 3892 Sep 24 17:22 erb
-rwxr-xr-x 1 root root 558 Sep 24 17:22 gem
-rwxr-xr-x 1 root root 334 Sep 24 17:22 irb
-rw-r--r-- 1 root root 4392 Sep 25 13:45 Makefile
-rw-r--r-- 1 root root 22287 Sep 25 13:45 mkmf.log
-rwxr-xr-x 1 root root 407 Sep 24 17:22 passenger-config
-rwxr-xr-x 1 root root 423 Sep 24 17:22 passenger-install-apache2-
module
-rwxr-xr-x 1 root root 421 Sep 24 17:22 passenger-install-nginx-
module
-rwxr-xr-x 1 root root 417 Sep 24 17:22 passenger-make-enterprisey
-rwxr-xr-x 1 root root 413 Sep 24 17:22 passenger-memory-stats
-rwxr-xr-x 1 root root 413 Sep 24 17:22 passenger-spawn-server
-rwxr-xr-x 1 root root 407 Sep 24 17:22 passenger-status
-rwxr-xr-x 1 root root 412 Sep 24 17:22 passenger-stress-test
-rwxr-xr-x 1 root root 382 Sep 24 17:22 rackup
-rwxr-xr-x 1 root root 384 Sep 24 17:22 rails
-rwxr-xr-x 1 root root 380 Sep 24 17:22 rake
-rwxr-xr-x 1 root root 1545 Sep 24 17:22 rdoc
-rwxr-xr-x 1 root root 64 Sep 24 17:19 ree-version
-rwxr-xr-x 1 root root 1501 Sep 24 17:22 ri
-rwxr-xr-x 1 root root 2630142 Sep 24 17:19 ruby
-rwxr-xr-x 1 root root 163 Sep 24 17:22 testrb
-rwxr-xr-x 1 root root 424 Sep 24 17:37 update_rubygems

7. echo $PATH
/opt/ruby-enterprise/bin/:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/
local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

8. My /etc/selinux/config contains SELINUX=disabled #enforcing
9.. I have also turned off service iptables.
10. Inside /etc/httpd/conf/httpd.conf
#
# The following modules are not loaded by default:
#
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule asis_module modules/mod_asis.so
LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/
gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/
passenger-2.2.5
PassengerRuby /opt/ruby-enterprise/bin/ruby

and at bottom:
<VirtualHost *:80>
ServerName railstest
DocumentRoot /opt/emr/public
RailsEnv development
</VirtualHost>

Issue description:

1. I have created one test rail application named as emr with
following command:
rails emr -d mysql
2. Modified database.yaml as per need and done some scaffolding to
make application work.
3. Now my test rail application is working fine with database
interaction if we are running it with ruby script/server
4. Now the main issue: If i am running it with apache by typing url in
browser it is showing default public index page, MEANS IT IS
RECOGNIZING RAILS APPLICATION but now am trying to open page with
database interaction then GETTING ERROR IN DEVELOPMENT LOG which is
given below:
###################################################################
/!\ FAILSAFE /!\ Fri Sep 25 18:30:55 +0530 2009
Status: 500 Internal Server Error
Can't connect to local MySQL server through socket '/var/lib/mysql/
mysql.sock' (13)
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/mysql_adapter.rb:585:in
`real_connect'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/mysql_adapter.rb:585:in `connect'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/mysql_adapter.rb:199:in `initialize'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/mysql_adapter.rb:71:in `new'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/mysql_adapter.rb:71:in
`mysql_connection'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
`send'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:184:in
`checkout'
/opt/ruby-enterprise/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
123:in `retrieve_connection'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
115:in `connection'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/query_cache.rb:9:in `cache'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/query_cache.rb:28:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/
rack-1.0.0-git/lib/rack/head.rb:9:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/
rack-1.0.0-git/lib/rack/methodoverride.rb:24:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/params_parser.rb:15:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/
rack-1.0.0-git/lib/rack/head.rb:9:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/
rack-1.0.0-git/lib/rack/methodoverride.rb:24:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/params_parser.rb:15:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/session/cookie_store.rb:93:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/failsafe.rb:26:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/
rack-1.0.0-git/lib/rack/lock.rb:11:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/
rack-1.0.0-git/lib/rack/lock.rb:11:in `synchronize'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/vendor/
rack-1.0.0-git/lib/rack/lock.rb:11:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/dispatcher.rb:114:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/reloader.rb:34:in `run'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/
action_controller/dispatcher.rb:108:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/rack/request_handler.rb:95:in `process_request'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/railz/application_spawner.rb:378:in
`start_request_handler'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/railz/application_spawner.rb:336:in
`handle_spawn_application'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/utils.rb:183:in `safe_fork'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/railz/application_spawner.rb:334:in
`handle_spawn_application'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:352:in `__send__'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:352:in `main_loop'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:163:in `start'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/railz/application_spawner.rb:213:in `start'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:352:in `__send__'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:352:in `main_loop'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/
phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5/bin/
passenger-spawn-server:61
########################################################################

Please help me to figure it out.

irongaze

unread,
Sep 25, 2009, 11:32:40 AM9/25/09
to Phusion Passenger Discussions
Not a passenger issue. First google hit for your error yields this
link:

http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/

Give it a try, and next time, please try a bit of googling on your
error messages before posting for help. Many issues can be resolved
with a little research.

Cheers!

Kunwar Manish Tomar

unread,
Sep 25, 2009, 2:55:49 PM9/25/09
to phusion-...@googlegroups.com
Hi,
Sorry sir but i lready googled and did not get proper solution so written here. my /etc/my.cnf already contains:
[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
 
and also i am able to connect from commad by typing mysql -uabc -pabc and also created database there what my rails app is conncting properly with webrick(default rails server)
 
Please have a look on development error log I have pasted on last post at bottom, also teling Can't connect to local MySQL server through socket '/var/lib/mysql/
mysql.sock' (13)

 

Mysql tells that (13) comes whensome permission issue but where not getting because indivdually all application is working except with cmbinaion passnger.
 
please help
thanks

--
Thanks and Best Regards
Kunwar Manish Tomar
Mobile: +919987015867
Mail: man...@hexaware.com
Hexaware Technologies Limited.

richardun

unread,
Sep 25, 2009, 4:37:32 PM9/25/09
to Phusion Passenger Discussions
Literally, this error from MySQL is not "working except with cmbinaion
passnger." This

I googled your error: http://tinyurl.com/yccm8ds

The first hit gave:

Error code 13 can be caused if:

- user/host permissions are wrong
- file permissions are wrong
- mysql not running

There are other potential causes, but it's most likely permissions,
especially since you have mysql.sock in /var/lib/mysql/mysql.sock.
For applications to access it, it's probably better off somewhere more
accessible, like /tmp.

The first thing I'd do is create a symbolic link to mysql.sock from /
tmp

1. cd /tmp
2. ln -s /var/lib/mysql/mysql.sock mysql.sock

Either way, I don't believe it's a passenger issue, which means you
should post this somewhere else.

Richard



On Sep 25, 1:55 pm, Kunwar Manish Tomar <kunwar.to...@gmail.com>
wrote:
> Hi,
> Sorry sir but i lready googled and did not get proper solution so written
> here. my /etc/my.cnf already contains:
> [mysqld]
> datadir=/usr/local/mysql/data
> socket=/var/lib/mysql/mysql.sock
>
> and also i am able to connect from commad by typing mysql -uabc -pabc and
> also created database there what my rails app is conncting properly with
> webrick(default rails server)
>
> Please have a look on development error log I have pasted on last post at
> bottom, also teling *Can't connect to local MySQL server through socket
> '/var/lib/mysql/
> mysql.sock' (13)*
>
> **
> Mysql tells that (13) comes whensome permission issue but where not getting
> because indivdually all application is working except with cmbinaion
> passnger.
>
> please help
> thanks
>
>
>
> On Fri, Sep 25, 2009 at 9:02 PM, irongaze <zaph...@gmail.com> wrote:
>
> > Not a passenger issue.  First google hit for your error yields this
> > link:
>
> >http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-...
>
> > Give it a try, and next time, please try a bit of googling on your
> > error messages before posting for help.  Many issues can be resolved
> > with a little research.
>
> > Cheers!
>
> --
> Thanks and Best Regards
> Kunwar Manish Tomar
> Mobile: +919987015867
> Mail: mani...@hexaware.com
> Hexaware Technologies Limited.

Kunwar Manish Tomar

unread,
Sep 29, 2009, 2:17:19 AM9/29/09
to phusion-...@googlegroups.com
Hi Richard,
Thanks for your help, It is rocking now. I earliar got this link but was not able to solve it because that time i was not linked sock file instead i created new and so i was not able to meke it work but Your 2 steps made it work.
 
Thanks again and sorry for troubling you.

Mail: man...@hexaware.com
Hexaware Technologies Limited.

Richard Navarrete

unread,
Sep 29, 2009, 6:59:02 PM9/29/09
to phusion-...@googlegroups.com, phusion-...@googlegroups.com
No trouble. Just wanted to make sure you were getting your issue in front of the right crowd.

Glad it worked.  

--
Richard
Reply all
Reply to author
Forward
0 new messages