Running Rails 2 apps with modern MariaDB SQL server
You might have some trouble running a Rails LTS 2 app with MySQL 5.7.
MariaDB 10.x should work with both old and new Rails applications.
Switch to MariaDB
sudo apt remove mysql-common mysql-client mysql-server mysql-apt-config
sudo apt install mariadb-server mariadb-client mariadb-common libmariadb2
You should now have MariaDB 10.x. Check with
You still need the MySQL development headers so you can build the
sudo apt install libmysqlclient-dev
This should be unnecessary, but we include it just in case your MySQL adapter gem fails to load.
For every version of Ruby installed, remove the
gem uninstall --all mysql mysql2
The next time to work on a Rails project a
bundle install will get you back the gems.
Now run your test suite to see if the migration was successful.
Troubleshooting: Use an SQL compatibility mode
If you get unexpected SQL errors related to the handling of missing or invalid values, you need to either fix your app or remove the
STRICT_TRANS_TABLES SQL mode flag that is default in MariaDB 10.2.
Note that if you switch to a more liberal SQL mode for your app, you must make sure that all developers, staging server and production server use the same SQL mode.