我目前在使用亚马逊EC2(AMI Linux)+ MySQL,
我写了这样的代码:
MySqlConnection DBConn = new MySqlConnection();
DBConn.ConnectionString = "Server=ec2-**.compute-1.amazonaws.com;Database=****;uid=root;password=****;port=3306;charset=utf8";
try
{
DBConn.Open();
}
catch (Exception ex)
{
MessageBox.Show("connecting fail");
}
但出于某种原因,当我运行它的时候, 它会产生连接的故障错误。
我上网搜索,发现我需要设置“给予所有特权 *. * 至root@ localhost”
所以我就这么做了! So, I did that!
但它仍然不起作用。我想我跟踪了所有的步骤。
我目前在2008 & amp; Windows7 视觉工作室工作。
I Checked the error and it seems like it s a timeout error. I think it s a firewall thing but don t know what I should do. I set my security group so the TCP ports are opened to all (incl. Mysql). It s still not working. Isn t that the way to solve this problem?;( However, the thing that I am curious about is that I could access to the database using MySQL workbench before I set the security group.
对不起,我是全新的EC2。