Apparently ruby has trouble loading libmysql.dll. Normally this file is included with the 'mysql2' gem. If I check with 'gem list', the gem does appear to be installed:
...
mysql2 (0.4.8)
...
However, there is no libmysql.dll file in the entire ActiveRuby folder :
C:\ActiveRuby>dir libmysql.dll /s
Le volume dans le lecteur C n’a pas de nom.
Le numéro de série du volume est 246A-791A
Fichier introuvable
Solving the issue
Manually reinstalling the 'mysql2' gem will add the missing libmysql.dll to ActiveRuby and solve this issue.
C:\ActiveRuby>gem install mysql2
Fetching: mysql2-0.4.8-x64-mingw32.gem (100%)
======================================================================================================
You've installed the binary version of mysql2.
It was built using MySQL Connector/C version 6.1.10.
It's recommended to use the exact same version to avoid potential issues.
At the time of building this gem, the necessary DLL files were retrieved from:
http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.10-win32.zip
This gem *includes* vendor/libmysql.dll with redistribution notice in vendor/README.
======================================================================================================
Successfully installed mysql2-0.4.8-x64-mingw32
Parsing documentation for mysql2-0.4.8-x64-mingw32
Installing ri documentation for mysql2-0.4.8-x64-mingw32
Done installing documentation for mysql2 after 0 seconds
1 gem installed
C:\ActiveRuby>dir libmysql.dll /s
Le volume dans le lecteur C n’a pas de nom.
Le numéro de série du volume est 246A-791A
Répertoire de C:\ActiveRuby\lib\ruby\gems\2.3.0\gems\mysql2-0.4.8-x64-mingw32\vendor
01/08/2017 00:14 4 879 360 libmysql.dll
1 fichier(s) 4 879 360 octets
Total des fichiers listés :
1 fichier(s) 4 879 360 octets
0 Rép(s) 169 107 656 704 octets libres
Repeatability
Completely uninstalling ActiveRuby and deleting the C:\ActiveRuby folder, and reinstalling ActiveRuby will reproduce the issue.
My setup:
Description of the issue
If I try to connect to a mysql database using ActiveRecord with the following code (parameters anonymised):
I get the following error:
Apparently ruby has trouble loading libmysql.dll. Normally this file is included with the 'mysql2' gem. If I check with 'gem list', the gem does appear to be installed:
However, there is no libmysql.dll file in the entire ActiveRuby folder :
Solving the issue
Manually reinstalling the 'mysql2' gem will add the missing libmysql.dll to ActiveRuby and solve this issue.
Repeatability
Completely uninstalling ActiveRuby and deleting the C:\ActiveRuby folder, and reinstalling ActiveRuby will reproduce the issue.