找到“Select a Mirror to Start Downloading - mysql-connector-net-6.2.3-src.zip”这个没有现成的dll文件,我编译时出错,你有现成的6.2.3版的Mysql.Data.dll吗??
c# 连Mysql需要自己写或是下个中间件
有何难,先下载一个MySQLDriverCS.dll app.config: <add name="mysql" connectionString="Data Source=mydb;Password=111111;User ID=root;Location=192.168.1.1" />using MySQLDriverCS;string MySQLStr = ConfigurationManager.ConnectionStrings["mysql"].ConnectionString; MySQLConnection MySQLConn = new MySQLConnection(xxxxxxxxxxxxxxxxxxx); MySQLConn.Open();MySQLCommand MyCmd = new MySQLCommand(@"select * from table",MySQLConn); MyCmd.ExecuteNonQuery();如果是数据库乱码,1是你的库建的有问题,默认是拉丁 2是可以先这样MySQLCommand MyCmd = new MySQLCommand("set names GBK", MySQLConn); MyCmd.ExecuteNonQuery();再执行操作,就可以了
现在提示:“由于目标机器积极拒绝,无法连接。 ip:port”的错误。我在目标机器上用cmd连接都打不开?是不是mysql有什么授权的东东设置。 在目标机子上连接时出现:Error2003 <HY000>:“Cant't connect to MySql server on '*.*.*.*'”<10061>
现在是在有mysql的机子上,用cmd打开数据库:mysql -u 用户名 -p密码为空。就是打不开。报错: Can't connect to MySQL Server on 'localhost' <10061>。这个是什么问题??这个mysql是一个软件捆绑安装的。是软件解压后自动安装的那种mysql。mysql服务是启动过的。自动启动的。现在就是连接不上去。????
找到“Select a Mirror to Start Downloading - mysql-connector-net-6.2.3-src.zip”这个没有现成的dll文件,我编译时出错,你有现成的6.2.3版的Mysql.Data.dll吗??
app.config:
<add name="mysql" connectionString="Data Source=mydb;Password=111111;User ID=root;Location=192.168.1.1" />using MySQLDriverCS;string MySQLStr = ConfigurationManager.ConnectionStrings["mysql"].ConnectionString;
MySQLConnection MySQLConn = new MySQLConnection(xxxxxxxxxxxxxxxxxxx);
MySQLConn.Open();MySQLCommand MyCmd = new MySQLCommand(@"select * from table",MySQLConn);
MyCmd.ExecuteNonQuery();如果是数据库乱码,1是你的库建的有问题,默认是拉丁
2是可以先这样MySQLCommand MyCmd = new MySQLCommand("set names GBK", MySQLConn);
MyCmd.ExecuteNonQuery();再执行操作,就可以了
如果你的 mysql服务不是自动启动,那么你需要手动进行启动。
在命令行里输入:net start MySQL
这样就可以看到 MYSQL的启动了 。停止的话,直接输入net stop MySQL就可以了 。
Can't connect to MySQL Server on 'localhost' <10061>。这个是什么问题??这个mysql是一个软件捆绑安装的。是软件解压后自动安装的那种mysql。mysql服务是启动过的。自动启动的。现在就是连接不上去。????
可是这个mysql为一个jsp的网站服务着,这个网站调用这个mysql数据库都没一点问题。是不是mysql的配置了什么?或者那个软件捆绑这个mysql,给mysql加了限制什么的?现在我只能用这个mysql数据库,我知道ip,端口,用户名,密码,数据库名,表。就是连不上。