You can optionally omit the database
parameter in connection string. Doing so, you get a connection to the database server but you are not connected to any specific database.
Part of Example from MySQL documentation:
MySql.Data.MySqlClient.MySqlConnection conn;
string myConnectionString;
//myConnectionString = "server=localhost;uid=root;pwd=12345;database=test;";
myConnectionString = "server=localhost;uid=root;pwd=12345;";
try
{
conn = new MySql.Data.MySqlClient.MySqlConnection();
conn.ConnectionString = myConnectionString;
conn.Open();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message);
}
But you have to use database name to qualify the table or other object names within your queries.
Example:
select * from so.tbl_so_q23676633;
In the above example, 'so'
is the database qualifier for table 'tbl_so_q23676633'
.