This is another post under the "simple solutions to annoying problems" category. I was deploying a Rails app to a server on which I'd compiled MySQL from source. The deployment went fine until the deploy:migrate task:
* executing "cd /path/to/app/releases/20090714141105; rake RAILS_ENV=production db:migrate"
servers: ["foo.net"]
[foo.net] executing command
*** [err :: foo.net] !!! The bundled mysql.rb driver has been removed from
Rails 2.2. Please install the mysql gem and try again: gem install mysql.
*** [err :: foo.net] rake aborted!
*** [err :: foo.net] libmysqlclient.so.16: cannot open shared object file:
No such file or directory - /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so
*** [err :: foo.net]
*** [err :: foo.net] (See full trace by running task with --trace)
** [out :: foo.net] (in /path/to/app/releases/20090714141105)
command finished
failed: "sh -c 'cd /path/to/app/releases/20090714141105; rake RAILS_ENV=production db:migrate'" on foo.net
The problem was that I'd compiled MySQL with --prefix=/usr/local/mysql and that directory wasn't on the runtime linker path. So I edited /etc/ld.so.conf and added /usr/local/mysql/lib/mysql, ran ldconfig, and voila, all was well.
This problem was a little more confusing since the Rails app itself was running fine, and running script/console worked fine too. But that was because I had added the MySQL lib path to LD_LIBRARY_PATH in /etc/profile. Anyhow, hope this helps someone!
I spent all day long trying to solve this problem without success, but fortunately I found this information. Thank you very much, your post was very useful for me.
Best regards.
Posted by: Antonio Perez | September 21, 2009 at 02:38 AM
@antonio, cool, glad to hear it!
Posted by: tomcopeland | September 21, 2009 at 12:01 PM
I had a issue when i restart the apache after so many years and error was
httpd: Syntax error on line 233 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/modules/libphp5.so into server: libmysqlclient.so.16:
cannot open shared object file: No such file or directory
before as i can see the mysql was installed under /usr/local/mysql then i made following changes and then issue fixed.
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
echo "/usr/local/mysql" >> /etc/ld.so.conf
ran ldconfig
Cheers...
Posted by: Dilip Dil | November 04, 2010 at 07:19 AM