Incompatibily between ruby and mysql gem - mysql

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.

Related

Any way to install mysql2 GEM without installing mysql server locally

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.

How can I make Rails 3.1 work on Debian squeeze with MySQL Server 5.1?

I am trying to start a new application Ruby on Rails 3.1 on Debian Squeeze with MySQL Server 5.1 (the latest supported by Debian stable version).
I have problem with the mysql2 gem. When I use mysql2 gem version 0.2.6 rake migrations fail with error undefined method rows for nil class. I gooogled and everybody says that this error is resolved when one upgrades mysql2 gem to 0.3.X. However, when I do this upgrade I get another error about gem having been compiled for 5.5 mysql client and not 5.1.
Any help would much appreciated. Maybe the answer is "NO. YOU CANNOT DO IT". Even then, I want to know that.
Thanks in advance
Panayotis
Well, this is a tricky question. My current rails package latest version is 2.3.5-1.2+squeeze2 and the current mysql-server package is 5.1.49-3, both from the stable debian repositories.
However, you're trying to install RoR 3.1. That means you're not on stable or you are not trying to install it from any of the official debian repository at all (it is not wheeze nor sid).
If you can install the stable version of rails, go ahead and I bet you won't have any trouble. Otherwise, if you want the most current release I'm pretty sure you'll have to go for the dirty way. It might probably involve download a 5.5 MySQL (not from the repositories, because it isn't there) and messing with the libraries.
Remember if you require newer packages (such as newer libraries) and you don't want to use the testing repositories, you can always give debian backports a try.

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.

Facing lot of problems while using ROR

I am new to Ruby on Rails. I have read many article regarding easy installing steps. I installed ruby on windows. After starting the server i got welcome message too. After that if i add a controller I got this message on browser.
And also when tried to do a rake db:migrate i get the error saying mysql gem is missing.
I have installed mysql 5.0. I tried updating gem using this command and got this error.
C:\Documents and Settings\dchannap\Desktop>gem install mysql
ERROR: http://rubygems.org/ does not appear to be a repository
ERROR: Could not find a valid gem 'mysql' (>= 0) in any repository
My gem version is 1.3.7. and ruby is 1.9.1.
Can anyone help me in this regard. I hav to do a project on ROR..
Its probably internet connection or server side problem.
Here is similair question
You'll find it much easier to get started using SQLite3. Why not go with the flow for now? When you need to go more advanced you'll have much more experience with Ruby and Rails and Gems and you'll find it much easier to get sorted.
Are you behind a proxy? In that case you will have to specify it. E.g.
gem install --http-proxy http://your-proxy-address:8080 mysql
Thanks for all the replies.. I learnt Rails on Windows will face problems. And just tried with Instant rails. I faced no problems at all. I am able run small applicatins now.