views:

72

answers:

3

Every time I run rake db:create, I get the notice that I have to run "sudo gem install mysql", but I do not have root access and the tech support is telling me that they cannot do that for me since it is on a shared server.

Is there any work around about this? I do not have the option of changing hosting as of right now.

A: 

If you are not root, your gems become installed in your home dir - if you run your application under your username, the gems become loaded from your .gems directory.

Lichtamberg
A: 

Can't you just run

gem install mysql

?

They should get installed in your user's directory. If not, ask your host again. Mine will install any common gem if asked nicely.

marcgg
> gem install mysqlWARNING: Installing to ~/.gem since /usr/local/lib/ruby/gems/1.8 and /usr/local/bin aren't both writable.WARNING: You don't have /usr/home/reve18/.gem/ruby/1.8/bin in your PATH, gem executables will not run.Building native extensions. This could take a while...ERROR: Error installing mysql: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby18 extconf.rb install mysqlchecking for mysql_query() in -lmysqlclient... nochecking for main() in -lm... yeschecking for mysql_query() in -lmysqlclient... nochecking for main() in -lz... yeschecking for mysql_query() in -lmysqlclient... nochecking for main() in -lsocket... nochecking for mysql_query() in -lmysqlclient... nochecking for main() in -lnsl... nochecking for mysql_query() in -lmysqlclient... no
I've asked my really crappy hosting tech support but they are not being very friendly about doing this for me.. any suggestions??
you could try freezing the gem... http://www.softiesonrails.com/2008/1/3/freezing-your-rails-application
marcgg
the other way around would be to roll back to rails 2.1, before the mysql gem
marcgg
+1  A: 

Looks like it can't find the MySQL libraries to build the native extension. You can find out where the libs and includes are installed by running

mysql_config --libs --include

which will produce something like

-rdynamic -L/usr/local/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm -lmygcc
-I/usr/local/mysql/include

Then with the -L option(location of the mysql libraries) and the -I option(location of the mysql include files) you can install the gem like this

gem install mysql -- --with-mysql-include=/usr/local/mysql/include --with-mysql-lib=/usr/local/mysql/lib

Obviously the paths for your install will be different, but hopefully you get the idea.

slillibri