0

Is there any chance to make Rails application connect to old MySQL v4.1.20 server?

rails db 

command works fine, but I cannot run the application.

When I generate new app with

rails new app_name -d mysql

I see the following in database.yml file:

MySQL. Versions 4.1 and 5.0 are recommended.

Which should mean I am able to use it. However Rails Active Record uses MySQL v.5.0.2+ feature (https://github.com/rails/rails/blob/4-0-stable/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb):

# Make MySQL reject illegal values rather than truncating or blanking them, see
# http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_all_tables
# If the user has provided another value for sql_mode, don't replace it.

    if strict_mode? && !variables.has_key?(:sql_mode)
      variables[:sql_mode] = 'STRICT_ALL_TABLES'
    end

Unfortunately I have nothing to do with old MySQL server version. I have to use it.

Mikhail Chuprynski
  • 2,404
  • 2
  • 29
  • 42
  • It might be more productive to simply update MySQL. In any case, "cannot run the application" is a near-useless statement that doesn't describe the problem. – user2864740 Apr 11 '14 at 20:07
  • @user2864740 I cannot update it. It is third-party application I have to work with. – Mikhail Chuprynski Apr 11 '14 at 20:10
  • @MikhailChuprynski Are you sure it's 4.1.2? That wasn't even a beta version, see [version history](https://dev.mysql.com/doc/refman/4.1/en/news-4-1-x.html). More probably it's 4.1.20. But even that is dangerously old. – VMai Apr 11 '14 at 20:14
  • @VMai Server version: 4.1.20-community – Mikhail Chuprynski Apr 11 '14 at 20:16

1 Answers1

0

Adding

strict: false

to the connector settings in database.yml solved the problem.

Mikhail Chuprynski
  • 2,404
  • 2
  • 29
  • 42