I am making one application using RoR with mysql.I followed the below steps for making app with mysql.
1-rails new projectname -d mysql
2-rails generate scaffold Post title:string body:text
After running the 2nd step I got the following error.
Error:
Failed to load libmysql.dll from C:\Ruby193\lib\ruby\gems\1.9.1\gems\mysql2-0.3.
18-x86-mingw32\vendor\libmysql.dll
I have installed mysql in my system and copied the libmysql.dll file from mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll to C:\Ruby193\bin still i am getting the above error.Please try to help me to resolve this error and i am also interested to know if my mysql DB is present in some other instance instead of my local system how can i connect it using Rails.
I am using Rails version-3.2.19 and win-xp in my system.
This happened to me after I upgraded to mysql2 0.4.7+. Versions after 0.4.6 use MySQL Connector C 6.1.10+. The release notes mention that in order to compile MySQL Connector C, you will need Visual C++ Redistributable for Visual Studio 2015 installed. After installing that and reinstalling mysql2, the error went away.
I found out that there is 32bit and 64bit variations of libmysql.dll. Give both of them a try. For me 32bit libmysql.dll worked.
After some "Google Work" and try on a Win2k3 Server, it seems like a problem case by "binary version of mysql2".
In recent versions of mysql2, it contains libmysql.dll unlike before it need to compile locally, and the version of libmysql.dll comes from MySQL Connector 6.1.x which remove WinXp/2k3's support.
So, you can try this way i have success in my Redmine installation:
gem uninstall mysql2
and remove all mysql2 packagegem install mysql2 --platform=ruby -- '--with-mysql-lib="D:\MySQLConn\lib" --with-mysql-include="D:\MySQLConn\include"'
gem list mysql2
I hope it will helpful for you.