Ruby gem install mysql2 with pre-installed MySQL

I have pre-installed MySQL and I would like to use it with my rails. This is the solution.

1. Run gem install mysql2 with parameters
–with-mysql-lib=”MySQL Lib Path”
–with-mysql-include=”MySQL Include Path”
–with-mysql-dir=”MySQL Path”

In my case, I using wamp, it can differ so you should change to your path.

gem install mysql2 --platform=ruby -- '--with-mysql-lib="D:\wamp\bin\mysql\mysql5.5.24\lib" --with-mysql-include="D:\wamp\bin\mysql\mysql5.5.24\include" --with-mysql-dir="D:\wamp\bin\mysql\mysql5.5.24"'

2. Copy libmysql.dll in MySQL lib directory to Ruby bin directory.

That’s all.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s