Any way to install mysql2 GEM without installing mysql server locally - mysql

I want to use a remote MySQL database. Is there any way to install mysql2 gem in OS X without installing MySQL server locally?
Update: I found the solution. Actually, I don't need the MySQL server installed locally, I just need to install the adapter as follow..
brew install mysql-connector-c
Followed by,
gem install mysql2

Looks like the gem needs mysql installed locally to run as it uses some underlying c libraries for the client. I don't think it can work without it.
Check out https://github.com/tmtm/ruby-mysql which i believe is native ruby and may not need it, but is not compatible with 4.1.x.

Related

How to get sphinx to install with mysql support using homebrew

I am attempting to get sphinx installed on my Mac OS X (10.8.3) laptop so that I can do some full text searching on a rails app using thinking sphinx.
The commands I have used for installing sphinx are:
brew install sphinx --mysql
and
brew install sphinx --with-mysql=/usr/local/mysql
Neither seem to work. Once sphinx is installed it simply says I need to install postgres or mysql in order to use it.
Does anyone know how I can force homebrew to install sphinx with mysql support?

Ruby Gem for mysql 5.5 in windows

We are going to use mysql 5.5 in our application for production. I did some online search and it seems that mysql2 0.2.6 is the one for mysql5.5. Is this gem good for windows as well? Any tips on how to install and manage for production?
Thanks.
The gems (either mysql or mysql2) provides an version-independent layer to the version of MySQL you are running.
However, if you're using a pre-compiled gem, it will require a version specific MySQL library be installed in your system.
To avoid that, you can use MySQL Connector/C which provides a version-independent way to connect to MySQL.
I've documented how to compile mysql gem against MySQL Connector/C in this blog post:
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
mysql2 gem has some issues on Windows so I would recommend you use mysql gem for the time being.
Hope this helps.

installing mysql as a gem

i want to develop rails 3 apps using mysql on windows 7 (64 bit) and i have installed mysql via the msi download from the mysql site.
my question is that do i still need to install the mysql gem?
thanks
The mysql gem provides the ruby bindings, so yes, you need to install this.
With Rails 3 you should use the mysql2 gem rather than the mysql gem.
Here is a proper solution for anyone interested, that doesn't mess up your current installation of mysql server
Download a zip file with mysql server 5.1 NOT the msi one. Make sure it's 32-bit NOT 64-bit. (From here)
Since there is no installer file with this, create a folder c:\mysql-gem-install - you can remove it once you finish.
Extract all the files from the zip file into the folder you just created.
now run this command
gem install mysql2 -- '--with-mysql-lib="c:\mysql-gem-install\lib\opt" --with-mysql-include="c:\mysql-gem-install\include"'
I just installed mysql2 gem v. 0.3.7
Yes you do. The mysql gem is a ruby driver (interface) to connect to the mysql database.
You should use mysql2 gem instead with Rails3.

How do I install the mysql gem without a mysql server?

I'm trying to install the mysql2 gem for a rails app on a machine with an external mysql server. The machine I'm installing onto doesn't have or need a mysql server on it. However, whenever I try to install it always checks for a mysql install and fails.
Is there an install configuration or work-around for this?
Cheers
You need just the MySQL header files to be there where the native compiling takes place.
Depending on your OS / Distribution you should find the way to install the header files without installing the actual server (Debian / Ubuntu alikes should allow you to do so with the standard apt-get, but I might be wrong).
If you are on Windows, please check this post about mysql2 gem issues on Windows.

Incompatibily between ruby and mysql gem

When trying to install the mysql gem from cPanel on my website, I get an error saying that the gem requires Ruby >= 1.8.6.
This is a shared server and the version of Ruby is 1.8.5 and can't be upgraded.
I do not have shell access and it seems the only way for me to install a gem is through the list of gems within cPanel.
How can I get mysql for my website?
You can try to install an older gem. 2.7.5 seems to be the proper version.
Ruby 1.8.5 is pretty old and as far as I know hasn't been actively supported by Rails for a while. You really need 1.8.6 and preferably 1.8.7. If your host won't upgrade it may be time to look elsewhere. If you really have no other option, you should to what Yuval suggests and try installing an older version of the gem.
No one having answered how to install a gem without shell access, I'll assume it can't be done and so will accept my own answer.