Monday, April 21, 2014

Installing Ruby 2.1.1 in Ubuntu 14.04

The apt-get way don't install the latest stable Ruby (2.1.1), even on Ubuntu 14.04. Instead, I got 1.9.3 that way. RVM can be easy, but to work with Apache I'd need a system-wide installation independent of the RVM environment. So I've decided to install Ruby from source. I had problems around readline, but after seeing this hint, the solution that worked for me is:

./configure --with-readline-dir=/usr/lib/x86_64-linux-gnu/libreadline.so
make
make install

on the directory of the unpacked source of Ruby 2.1.1, as root. I suspect there is a more elegant solution out there, but this is enough for me at this time.

Friday, March 7, 2014

LOAD DATA INFILE tips

If you're having troubles with LOAD DATA INFILE ("Errcode 13"):
  • copy the CSV file to the DB folder (/var/lib/mysql/DATABASE), and
  • use the filename only, not the full path.


If you're having troubles with LOAD DATA LOCAL INFILE ("The used command is not allowed with this MySQL version"):
  • temporary solution: mysql -uUSER -p --local-infile DATABASE
  • permanent solution: sudo nano /etc/mysql/my.cnf and insert local-infile under [mysql]; save the file, close the editor and type sudo service mysql restart.

Note: LOAD DATA LOCAL INFILE uses IGNORE. If you want to know why some records were skipped, you must use LOAD DATA INFILE (without LOCAL). (Reference)