用Mono来连接MySQL数据库在Linux上

数据库 MySQL
今天我们向大家描述的是在Linux上正确使用Mono来连接MySQL数据库的实际操作方案,其中也有对其实际应用代码的详细介绍。

此文章主要向大家描述的是在Linux上使用Mono来连接MySQL数据库的一大绝招,我们大家都知道连接MySQL数据库在实际应用中是经常出现的,所以很多人对其也是备受关注的。其具体内容参考的例子可以再相关网站上查询。

特别提出来的是我***次编译运行的时候出现这样的错误提示:

  1. MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts  
  2. in <0x006c5> MySql.Data.MySqlClient.NativeDriver:Open ()  
  3. in <0x00027> MySql.Data.MySqlClient.Driver:Create (MySql.Data.MySqlClient.MySqlConnectionString settings)  
  4. in <0x0008d> MySql.Data.MySqlClient.MySqlPool:CreateNewPooledConnection ()  
  5. in <0x001b0> MySql.Data.MySqlClient.MySqlPool:GetPooledConnection ()  
  6. in <0x0003f> MySql.Data.MySqlClient.MySqlPool:GetConnection ()  
  7. in <0x000e5> MySql.Data.MySqlClient.MySqlPoolManager:GetConnection (MySql.Data.MySqlClient.MySqlConnectionString settings)  
  8. in <0x00050> MySql.Data.MySqlClient.MySqlConnection:Open () 

不思不得其解,后来找到一个国外的论坛,得到这样的提示:

  1. The most likely cause of this is that MySQL is not configured to accept tcp/ip connections.  
  2. See here http://dev.mysql.com/doc/mysql/en/can-not-connect-to-server.html  
  3. make sure your /etc/mysql/my.cnf file does not have the "skip-networking" 
  4. feature enabled. This is the default in some installations and disables tcp/ip connections. 

根据提示我把my.cnf中的

  1. # Instead of skip-networking the default is now to listen only on  
  2. # localhost which is more compatible and is not less secure.  
  3. #bind-address = 172.22.60.126 

bind-address注释掉,然后重新启动mysql服务器程序sudo /etc/init.d/mysql restart就可以正常连接查询了。以上的相关内容就是对在Linux上使用Mono连接MySQL数据库的介绍,望你能有所收获。

 

在Linux上使用Mono连接MySQL数据库

上述的相关内容就是对在Linux上使用Mono连接MySQL数据库的描述,希望会给你带来一些帮助在此方面。

【编辑推荐】

  1. MySQL数据库中最基本的函数类型
  2. MySQL数据库中的字符串
  3. MySQL数据库权限设置的实际运行过程
  4. MySQL 分页存储过程的实际操作流程与代码
  5. MySQL_fetch_row() 和 MySQL_fetch_array() 的差异

 

责任编辑:佚名 来源: cnblogs
相关推荐

2011-06-10 10:31:57

QT mysql linux

2017-06-19 08:13:00

Sequel ProMySQL数据库

2010-06-11 14:46:13

MySQL数据库

2010-03-04 17:19:40

2019-11-07 15:02:00

Linuxstrace系统调用

2011-04-26 10:37:04

C++MySQL

2011-04-26 10:24:27

C++MySQL

2010-05-20 09:45:22

连接MySQL

2009-07-14 18:13:36

Microsoft J

2010-06-04 18:12:17

MySQL 数据库启动

2020-09-22 15:56:31

Java

2011-05-26 13:42:50

MFC连接MySql数据库

2010-05-20 16:13:55

2010-06-04 11:21:41

连接MySQL数据库

2010-10-26 15:00:36

oracle远程连接数

2010-06-07 14:34:49

连接MySQL 数据库

2015-10-23 14:37:56

DelphiDBExpress连接

2017-11-27 11:41:06

python数据库数据分析

2024-01-02 08:47:42

2011-03-08 08:49:55

MySQL优化单机
点赞
收藏

51CTO技术栈公众号