如何只连接服务器,不连接数据库?
String ds1 = String.Format("Allow User Variables=True;
Server={0};
Port={1};
Uid={2};
Pwd={3};
ConnectionReset=true;", mServer, mPort, mUser, mPassword);
MySqlConnection Conn1 = new MySqlConnection(ds1);
Conn1.Open();
Conn1.Close();
String ds2 = String.Format("Allow User Variables=True;
Server={0};
Port={1};
Uid={2};
Pwd={3};
ConnectionReset=true", mServer, mPort, mUser, mPassword);
MySqlConnection Conn2 = new MySqlConnection(ds2);
Conn2.Open();
代码运行到Conn2.Open()时,会出错,提示
Authentication to host '127.0.0.1' for user 'root' using method 'mysql_native_password' failed with message: Unknown database ' '