Skip to content

Commit 85d9cce

Browse files
committed
Merge pull request #419 from monban/windows-instructions
Added clearer installation instructions for Windows users
2 parents b793e24 + 83fbdcf commit 85d9cce

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Mysql2::Client - your connection to the database
1515
Mysql2::Result - returned from issuing a #query on the connection. It includes Enumerable.
1616

1717
## Installing
18-
18+
### OSX / Linux
1919
``` sh
2020
gem install mysql2
2121
```
@@ -24,6 +24,26 @@ This gem links against MySQL's `libmysqlclient` C shared library. You may need t
2424

2525
If you have installed MySQL to a non-standard location, add `gem install mysql2 --with-mysql-config=/some/random/path/bin/mysql_config`
2626

27+
### Windows
28+
First, make sure you have the DevKit installed (http://rubyinstaller.org/downloads/) and its variables
29+
are loaded by running devkit\devktvars.bat .
30+
31+
Next, you need a MySQL library to link against. If you have MySQL loaded on your development machine,
32+
you can use that. If not, you will need to either copy the MySQL directory from your server, or else
33+
obtain a copy of the MySQL C connector: http://dev.mysql.com/downloads/connector/c/
34+
35+
If you're using the connector, I recommend just getting the .zip file and unzipping it someplace convenient.
36+
37+
Now you can install mysql2. You must use the `--with-mysql-dir` option to tell gem where your MySQL library
38+
files are. For example, if you unzipped the connector to c:\mysql-connector-c-6.1.1-win32 you would install
39+
the gem like this:
40+
41+
gem install mysql2 -- --with-mysql-dir=c:\mysql-connector-c-6.1.1-win32
42+
43+
Finally, you must copy libmysql.dll from the lib subdirectory of your MySQL or MySQL connector directory into
44+
your ruby\bin directory. In the above example, libmysql.dll would be located at
45+
c:\mysql-connector-c-6.1.1-win32\lib .
46+
2747
## Usage
2848

2949
Connect to a database:

0 commit comments

Comments
 (0)