首页 > 代码库 > Linux安装MySql.Data for mono

Linux安装MySql.Data for mono

wget http://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-6.8.3-noinstall.zip
unzip mysql-connector-net-6.8.3-noinstall.zip

# Rename Files to Linux
$ mv v2.0/mysql.data.cf.dll v2.0/MySql.Data.CF.dll
$ mv v2.0/mysql.data.dll v2.0/MySql.Data.dll
$ mv v2.0/mysql.data.entity.dll v2.0/MySql.Data.Entity.dll
$ mv v2.0/mysql.web.dll v2.0/MySql.Web.dll
$ mv v4.0/mysql.data.dll v4.0/MySql.Data.dll
$ mv v4.0/mysql.data.entity.dll v4.0/MySql.Data.Entity.dll
$ mv v4.0/mysql.data.entity.EF6.dll v4.0/MySql.Data.Entity.EF6.dll
$ mv v4.0/mysql.web.dll v4.0/MySql.Web.dll
$ mv v4.5/mysql.data.dll v4.5/MySql.Data.dll
$ mv v4.5/mysql.data.entity.EF5.dll v4.5/MySql.Data.Entity.EF5.dll
$ mv v4.5/mysql.data.entity.EF6.dll v4.5/MySql.Data.Entity.EF6.dll
$ mv v4.5/mysql.web.dll v4.5/MySql.Web.dll

#Copy To Mono RunTime
$ sudo cp v2.0/*.* /usr/lib/mono/2.0
$ sudo cp v4.0/*.* /usr/lib/mono/4.0
$ sudo cp v4.5/*.* /usr/lib/mono/4.5

#Install in GAC
$ sudo gacutil -i /usr/lib/mono/2.0/MySql.Data.CF.dll
$ sudo gacutil -i /usr/lib/mono/2.0/MySql.Data.dll
$ sudo gacutil -i /usr/lib/mono/2.0/MySql.Data.Entity.dll
$ sudo gacutil -i /usr/lib/mono/2.0/MySql.Web.dll
$ sudo gacutil -i /usr/lib/mono/4.0/MySql.Data.dll
$ sudo gacutil -i /usr/lib/mono/4.0/MySql.Data.Entity.dll
$ sudo gacutil -i /usr/lib/mono/4.0/MySql.Data.Entity.EF6.dll
$ sudo gacutil -i /usr/lib/mono/4.0/MySql.Web.dll
$ sudo gacutil -i /usr/lib/mono/4.5/MySql.Data.dll
$ sudo gacutil -i /usr/lib/mono/4.5/MySql.Data.Entity.EF5.dll
$ sudo gacutil -i /usr/lib/mono/4.5/MySql.Data.Entity.EF6.dll
$ sudo gacutil -i /usr/lib/mono/4.5/MySql.Web.dll

#Check Installed Assemblies
$ sudo gacutil -l | grep MySql

MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
MySql.Data.CF, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
MySql.Data.Entity, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
MySql.Data.Entity.EF5, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
MySql.Data.Entity.EF6, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d

# Pack files
$ tar cvzf mysql-connector-net-6.8.3-ubuntu-12.04.mono.tar.gz /usr/lib/mono/2.0/MySql* /usr/lib/mono/4.0/MySql* /usr/lib/mono/4.5/MySql*
/usr/lib/mono/2.0/MySql.Data.CF.dll
/usr/lib/mono/2.0/MySql.Data.dll
/usr/lib/mono/2.0/MySql.Data.Entity.dll
/usr/lib/mono/2.0/MySql.Web.dll
/usr/lib/mono/4.0/MySql.Data.dll
/usr/lib/mono/4.0/MySql.Data.Entity.dll
/usr/lib/mono/4.0/MySql.Data.Entity.EF6.dll
/usr/lib/mono/4.0/MySql.Web.dll
/usr/lib/mono/4.5/MySql.Data.dll
/usr/lib/mono/4.5/MySql.Data.Entity.EF5.dll
/usr/lib/mono/4.5/MySql.Data.Entity.EF6.dll
/usr/lib/mono/4.5/MySql.Web.dll

Done !

Linux安装MySql.Data for mono