c#.net与mysql数据库连接的连接字符串

时间:2013-03-04 08:56:54

标签: c# mysql

我的服务器上存有一个mysql数据库:ip:50.62.82.45,数据库名称是:detail_admin,用户id是:welcome,密码是:hello,然后是什么连接字符串供我访问和激活查询在mysql的服务器数据库

我试过这个但是没有用

server = "50.62.82.45";
            database = "detail_admin";
            uid = "welcome";
            password = "hello";
            string connectionString;
            connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";

            connection = new MySqlConnection(connectionString);

(mysql-connector-net-6.0.7-src.zip)这个用于连接的驱动程序

1 个答案:

答案 0 :(得分:0)

string myConnectionString = "SERVER=50.62.82.38;" +
                            "DATABASE=admin_urja;" +
                            "UID=welcome" +
                            "PASSWORD=hello;";
MySqlConnection connection = new MySqlConnection(myConnectionString);