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

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.

Related

Postfix install fails. MySQL conflict

I'm using CentOS 6, and trying to create a virtual mirror on a new server of an old one (which someone else setup). As much as possible, I want keep everything with the same version, but I've started from scratch and am documenting everything. By default, yum would install MySQL 5.1.73. I downloaded MySQL community v5.1.69 and installed it manually. This required installing a "shared compatibility" package of MySQL v5.1.69 first, and removing mysql-libs.x86_64. With that in place, I successfully mirrored MySQL.
Now, I'm trying to install Postfix. Yum wants to pull version 2.6.6-6. This fails because it requires a dependency that it attempts to install as well: mysql-libs.x86_64 v.5.1.73-5. It splits out a pile of errors messages which are all similar to this:
Transaction Check Error:
file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.1.73-5.el6_6.x86_64 conflicts with file from package MySQL-server-community-5.1.69-1.rhel5.x86_64
My old server is using postfix v2.6.6-2, which is apparently compatible with MySQL v5.1.69. I found the rpm for that version of postfix. It doesn't install, because it requires mysql-libs. I can't install mysql-libs v.5.1.69, because it conflicts with the MySQL community edition (also 5.1.69) that I installed. I tried to install the MySQL 5.1.73 "shared compatibility" package, but that conflicts with MySQL community too.
I'm going in circles. Is the only way to break this chain to uninstall MySQL community? Must I just use the v5.1.73 default, and the Postfix 2.6.6-6? I don't expect any real problems, but I'm going to end up with slightly different versions of MySQL and Postfix then I am trying hard to mirror.
I gave up, uninstalled all the MySQL community packages, and just installed the out of the box yum MySQL and Postfix. That works, but I now have different versions of this software on these two servers as a result.

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.

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.

MySQL driver for Rails in Windows 7 x64

I've got problem with connecting to MySQL database on my freshly installed Windows 7 machine.
I'm getting this error when I try to migrate my database.
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install
the mysql gem and try again: gem install mysql.
rake aborted!
193: %1 is not valid Win32 application - C:/Ruby/lib/ruby/gems/1.8/gems/mysql-2.8.1-x86-mswin32/lib/1.8/mysql_api.so
I currently have installed
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
mysql version 5.0.86 for Win64
gem 1.3.1
mysql-2.8.1-x86-mswin32
My colleague had a similar problem while running rails on Windows 7.
He had to replace the libmySQL.dll (in the PATH) with the one from InstantRails.
I spent hours trying to get MySQL and Rails to play nicely on Windows (albeit XP, both 32 and 64-bit versions). I finally gave up since my production box was running Linux (on which Rails and MySQL play very nicely) and just used SQLite 3 for development. No headaches to get it working and it runs fast enough for development purposes.
However, I did hear of some people that had luck replacing one of the DLLs provided by the gem with one provided by the official MySQL distribution. Also, some people simply didn't have this DLL at all which was causing problems. In the end, it didn't work for me, but hopefully you will have more luck.
For Rails or DataMapper or whatever to talk to MySQL you need a 32-bit driver in Rails\bin. The driver is called libmysql.dll. Even if you have a 64-bit server you need a 32-bit driver.
64-bit driver will fail will ruby/gems/1.8/gems/do_mysql-0.10.2-x86-mingw32/lib/do_mysql/1.8/do_mysql.so: 193: %1 is not a valid Win32 application.
A wrong 32-bit version will crash with memory allocation error or something weird like that (suggested solution to take libmysql.dll from another project may not work with newer versions of MySQL).
I am new to this rails. I just have passed the same issue in vista. after downloading libmySQL.dll (in the PATH) with the one from InstantRails it starts working.
sukumaaar#gmail.com
The solution to this problem is to simply install the 32-bit version of mysql.
Fast forward to March 2012. I solved this problem on windows 7 x64) by renaming my Ruby\b\bin\libmysql.dll and then copying libmysql.dll from C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\lib\opt to Ruby\bin
There was a newer version of libmysql.dll at C:\Program Files (x86)\MySQL\MySQL Workbench CE 5.2.37 but the gem didn't like the non 6.x version.
Could this be related to Ruby on Rails Win7 x64? ? If so, what was the fix again (couldn't figure it out from the first answer) ?
Another option which has worked for me is to download the 32bit version of mysql for windows and just keep the libmysql.dll and add the location of this DLL to the windows PATH.
Adding the libmySQL.dll from InstantRails to a dir in my path worked for me too. It's really sad that we have to do this sort of thing though. I'd like to see the gem, or MySql itself, install this DLL properly.
I'm running the current versions of everything on WinXP SP3: Ruby 1.9.2p0, MySQL 5.5, mysql 2.8.1. This issue is still present and to fix it I had to copy the Instant Rails libmysql.dll into my C:\Ruby192\bin directory. I initially copied the libmysql.dll file that came with MySQL 5.5 but that caused a seq fault!

Access error occured in Ruby 1.9 + MySQL

I can't connect mysql db with ruby1.9
OS -> Windows XP SP2
Ruby -> 1.9.1p0
dbi -> 0.4.2
dbd-mysql -> 0.4.3
MySQL API module for Ruby -> 2.7.3
DB(MySQL) -> 5.1.34-community
Because msvcrt-ruby18.dll was not found, I was not able to start this application.
What's wrong
One of the gems is looking for ruby 1.8.x probably the dbi or dbd gem. Try it with ruby 1.8.7
You might also consider the newer Ruby installer built with mingw. A tutorial on installing Ruby 1.9.1 with MySQL is available from The Ruby Installer Tutorials
One of the modules your application depends on was built for Ruby 1.8. The most likely culprit is the MySQL client binding, but it could be some other dependency being imported elsewhere in the code, as well.
Generally speaking, the support for Ruby 1.9 isn't yet all that good across most applications and 3rd-party libraries. Unless you have a very strong reason to use it, you'll probably have better luck sticking with the latest 1.8.X release.