What do I do if I don't have root access to do a gem install mysql?
-
05-07-2019 - |
Question
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.
No correct solution
OTHER TIPS
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.
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.
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.