如何使用 C# 连接到 MySQL 服务器? [英] How to connect to a MySQL server using C#?
问题描述
我有一个 C# 应用程序,它可以访问另一台计算机上的 MySQL 服务器.我正在尝试通过 IP 来实现.这是我的连接字符串:
I have a C# Application which would access a MySQL server on another computer. I am trying to do it via IP. Here is my Connection String :
result = "server =66.45.233.226; user id=testcampuscrm; password =Daph$5656; database=testcampuscrm; convert zero datetime=true; ";
出现错误
用户 'testcampuscrm'@'66.45.232.178' 的访问被拒绝(使用密码:是)
Access denied for user 'testcampuscrm'@'66.45.232.178' (using password: YES)
我的代码是花药托管和mysql数据库花药hostig请帮助我们.谢谢
My code is anther hosting and mysql database anther hostig please help us. Thanks
推荐答案
从另一台机器访问 mysql 时,您必须考虑多种因素 -
There is multiple things you have to take into consideration while accessing mysql from another machine some them are -
假设你写了正确的代码
1.更改mysql配置(my.ini)以接收来自所有IP的数据包
2.在托管Mysql的机器上为端口3306添加防火墙例外
3.用户名密码正确并被授予适当的权限.
PS:-请勿在公共论坛上共享服务器凭据
这篇关于如何使用 C# 连接到 MySQL 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!