Today I spent some good hours to debug the issues while installing 'mysql2' gem. It was failing again and again stating that 'libmysql' not found (even after applying the solution I mentioned in previous blog). To share, I am mentioning all the steps from previous blog with today findings.
- Install 'MySQL' on your machine. Choose the installation depending upon your machine architecture i.e. 32 or 64 bits
- Have devkit installed on your machine. It can be download from 'http://rubyinstaller.org/downloads/'
- Download right installer for your machine i.e. 32 or 64 bits
- Install devkit by following instructions at 'https://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
- Go to <MySQL installation dir>/lib and copy the 'libmysql.dll' to <ruby installation dir>/bin
- Try running gem install mysql or mysql2
- It should install now. However, if you still face problem, follow steps given below
- Try specifying the --with-mysql-lib and --with-mysql-include options with gem command by specifying the mysql installation respective directories
- If it still fails to load the 'libmysql', ensure that you don't have space in the path of MySQL installation directory.
- Simple solution could be to copy the lib and include folders to a simple path like C:/mysql and specify the path of include and lib folder with gem command using --with-mysql-lib and -include options
- Hopefully it should resolve the issue
Hope it will help.