I have read-access to a MySQL database and am trying to connect to it via the MySql ODBC 5.1 driver. I'm getting an authorization failure (401) from the server. The administrator set up my access as follows:
mysql> grant select, create temporary tables on theDatabase.* to 'adrian' identified by 'password';
I am successful in connecting to the database using tools like dbvisualizer.
The connection string I'm trying to use in C#.NET is as follows:
"Driver={MySQL ODBC 5.1 Driver};Server=theDatabaseServer;Database=theDatabase;User=adrian;Password=password;Option=3;"
Perhaps the problem is related to the inability to specify my limited authorization in the connection string? Any suggestions on how to get around this (without having to request full access to the db)?
And what is the magic in "Option=3" ... are there other options?
Thanks.
解决方案
Try for the user "uid" and for the password "pwd" in the query string. This should be a valid connection string:
string ConnectionString = @"driver={MySQL ODBC 3.51 Driver};server=localhost;database=books;uid=band;pwd=letmein;";