Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't Run my server in rails after upgrading to ubuntu 12.04

I just upgraded ubuntu from 11.10 to 12.04 and after that when I run my server inside my rails project I got this error

$ rails s
/usr/share/ruby-rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': 
libmysqlclient_r.so.16: cannot open shared object file: No such file or directory - 
/usr/share/ruby-rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/lib/mysql2/mysql2.so (LoadError)

any help please?

like image 597
Azzurrio Avatar asked Apr 29 '12 05:04

Azzurrio


2 Answers

Go to your project and follow the steps,

rvm gemset empty <gemset name>
gem install bundler
bundle install

It will solve your problem.

If that does not work, or if you are not using rvm, please use

gem uninstall mysql2
bundle install

from one of your mysql2-using Rails project's directory.

like image 152
Santosh Avatar answered Nov 19 '22 11:11

Santosh


I followed Babak's instruction that he posted and it worked after a small change.

My system is Ubuntu 12.04 server and it has Ruby1.9.3 installed so I did this

sudo apt-get install mysql-server libmysqlclient-dev

Seems like the libmysqlclient16-dev is now renamed to libmysqlclient-dev in Ubuntu 12.04

Afterwards I ran

gem install mysql2
like image 1
mackrauss Avatar answered Nov 19 '22 12:11

mackrauss