安装Mysql gem - 无法构建本机扩展

时间:2016-01-21 09:54:43

标签: mysql ruby rubygems

我曾尝试在Windows 7(x64)上安装mysql,但输出错误:

Failed to build gem native extension.

2 个答案:

答案 0 :(得分:0)

1:在Gemfile中添加<EntityType Name="Supplier"> <Key> <PropertyRef Name="SupplierID" /> </Key> <Property xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" Name="SupplierID" Type="Edm.Int32" Nullable="false" p6:StoreGeneratedPattern="Identity" /> <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /> <Property Name="ContactName" Type="Edm.String" MaxLength="30" FixedLength="false" Unicode="true" /> <Property Name="ContactTitle" Type="Edm.String" MaxLength="30" FixedLength="false" Unicode="true" /> <Property Name="Address" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /> <Property Name="City" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /> <Property Name="Region" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /> <Property Name="PostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /> <Property Name="Country" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /> <Property Name="Phone" Type="Edm.String" MaxLength="24" FixedLength="false" Unicode="true" /> <Property Name="Fax" Type="Edm.String" MaxLength="24" FixedLength="false" Unicode="true" /> <Property Name="HomePage" Type="Edm.String" MaxLength="Max" FixedLength="false" Unicode="true" /> <NavigationProperty Name="Products" Relationship="NorthwindModel.FK_Products_Suppliers" ToRole="Products" FromRole="Suppliers" /> </EntityType>

2:删除gem 'mysql2'

3:运行Gemfile.lock

会工作!!!

答案 1 :(得分:0)

您必须安装mysql客户端库:

http://dev.mysql.com/downloads/connector/c/