为Mono安装MySql连接驱动

为Mono安装MySql连接驱动(转)

DOTNET and Mono by default only support database connections to the Microsoft SQL Server through System.Data.SqlClient module. To make a connection to the MySQL server you need a connector module from MySQL.

Proceed with the following steps to obtain and install the MySQL .NET Connector:

1. Downloading MySQL .NET Connector

Either from MySQL (requires registration):

http://www.mysql.com/downloads/mirror.php?id=399565

or directly from one of the mirros:

ftp://ftp.gwdg.de/pub/misc/mysql/Downloads/Connector-Net/mysql-connector-net-6.3.6-noinstall.zip

2. Unzip the content into a directory

~> md connector
~> cd connector
~/connector> unzip ../mysql-connector-net-6.3.6-noinstall.zip
~/connector> ls
CHANGES  COPYING  MySql.Data.chm  README  Release Notes.txt  v2  v4

3. Change names of assemblies to proper names

~/connector> cd v2
~/connector/v2/ mv mysql.data.cf.dll MySql.Data.Cf.dll
~/connector/v2> mv mysql.data.dll MySql.Data.dll
~/connector/v2> mv mysql.data.entity.dll MySql.Data.Entity.dll
~/connector/v2> mv mysql.visualstudio.dll MySql.VisualStudio.dll
~/connector/v2> mv mysql.web.dll MySql.Web.dll
~/connector/v2> cd ../v4
~/connector/v4> mv mysql.data.dll MySql.Data.dll
~/connector/v4> mv mysql.data.entity.dll MySql.Data.Entity.dll
~/connector/v4> mv mysql.visualstudio.dll MySql.VisualStudio.dll
~/connector/v4> mv mysql.web.dll MySql.Web.dll

 

4. Copy assemblies into library directory of your mono installation

~/connector/v4> su
/home/user/connector/v4 # cp MySql.* /usr/lib/mono/4.0/.
/home/user/connector/v4 # cd ../v2
/home/user/connector/v2 # cp MySql.* /usr/lib/mono/2.0/.

 

5. Register the installed assemblies in the global assembly cache

~ # cd /usr/lib/mono/4.0
/usr/lib/mono/4.0 # gacutil -i MySql.Data.dll
/usr/lib/mono/4.0 # gacutil -i MySql.Data.Entity.dll
/usr/lib/mono/4.0 # gacutil -i MySql.VisualStudio.dll
/usr/lib/mono/4.0 # gacutil -i MySql.Web.dll
/usr/lib/mono/4.0 # cd ../2.0
/usr/lib/mono/2.0 # gacutil -i MySql.Data.Cf.dll
/usr/lib/mono/2.0 # gacutil -i MySql.Data.dll
/usr/lib/mono/2.0 # gacutil -i MySql.Data.Entity.dll
/usr/lib/mono/2.0 # gacutil -i MySql.VisualStudio.dll
/usr/lib/mono/2.0 # gacutil -i MySql.Web.dll

 

Note: For steps 3 (renaming) and 4 (copying), I don’t really understand why these steps are necessary, but on my OpenSuSE 11.3 machine it did only work out that way. Any suggestions to improve this procedure are welcome.

原文地址(已被墙):http://2sharp4u.wordpress.com/2011/01/08/installing-mysql-connector-for-mono/

posted @ 2013-09-19 21:47  icedog  阅读(700)  评论(0编辑  收藏  举报