Rails - gem install mysql doesn't work on cygw

2019-04-16 08:22发布

I tried to do

gem install mysql

but there is an error. "Could not create Makefile due to some reason..."

How do I fix this? I believe I installed mysql on cygwin. Help!!

标签: rubygems
3条回答
可以哭但决不认输i
2楼-- · 2019-04-16 08:31
  • First, download the MySQL source code - you'll want the same version as whatever MySQL version you already have running (I'm using 5.1.42, which is the current binary from the MySQL Web site, but select whatever you need here: MySQL Snapshots)
  • Second, find a copy of ttydefaults.h and copy it into your /usr/include/sys - this one is fine: ttydefaults.h. When I say grab it and put it in, I mean literally either use wget or type:

vi /usr/include/sys/ttydefaults.h

and paste it in

  • Third, go into your mysql source directory, and type ./configure --without-server --without-readline. Wait until this finishes.
  • Fourth, go into your mysql/libmysql directory, and type make install.
  • Fifth, go into your mysql/include directory and type:

cp mysqld_error.h /usr/local/include/mysql/

  • Next type:

gem install mysql

  • Finally, go into your source directory for ruby, and make sure all items where you want to connect to "localhost" have "host: 127.0.0.1" instead of leaving the host off. If you leave the host blank, or leave it as local host, you will get a /tmp/mysql.sock error.
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-04-16 08:39

gem install mysql --platform x86-mingw32 works in cygwin

查看更多
趁早两清
4楼-- · 2019-04-16 08:54

Unfortunately, you may have to recompile MySQL to obtain the necessary library files.

查看更多
登录 后发表回答